Creating a REST Request

The Yahoo! Search Web Services are all REST services. That means you can easily construct request URLs that will work in your browser, on the command line, and in your code. For our example, we'll construct a query to search the web for PDF files containing the term "finances". See the web search documentation to understand the details of this service.

URL Construction

Most API requests will use GET. If the specific documentation requires POST, see the section on POST URL construction below.

All search request URLs start with the hostname and resemble the following sample:

After the hostname are the service name and version number:


Next is the method followed by a question mark.


Those components form the base URL.

The method is followed by the actual query parameters, which take the form argument=value, where the arguments and values are url encoded. Multiple parameters are separated by an ampersand (&). The following example searches the web database for PDF files containing the term "finances":

The API documentation for each service provides the service name and lists all of the mandatory and optional parameters, in addition to describing the response structure, rate limits, etc.

POST URL Construction

Using POST to communicate with the API is very similar to using GET. All search request URLs still begin with the hostname, service name, version number and method:

Note that there is no question mark following the method.

The query parameters are passed in the POST data block. They still take the form argument=value and are properly url encoded. Multiple parameters are separated by an ampersand (&).