Method: /search_for_restaurants
Search for restaurants by a variety of search criteria.
Invocation
- This method can be invoked using either HTTP GET or HTTP POST.
- This method requires an API key
Request Parameters
| Parameter | Description | Type | Extra |
| what | The string against which restaurants are matched. (e.g., bar) | String | optional |
| where | A string describing a location around which the search results will be restricted. (e.g., san francisco, ca or 94131). You can also specify a location using a longitude/latitude coordinate pair using the notation -74.0:BY:40.9 If this field is left blank, the location is automatically determined by mapping the client IP address to latitude/longitude coordinates. Since IP-mapping is not guaranteed to be accurate, it is a good idea to always specify a location. |
String | optional |
| radius | The number of miles around the location (specified in the where field) to search. If this field is left blank, a default radius is supplied. The default raidus varies according to the location specified in the where field. | Float | optional |
| limit | The maximum number of matching restaurants to return. The default is 10 and maximum is 10. Zvents partners can exceed the maximum. | Integer | optional |
| offset | The number of restaurants to skip from the beginning of the search results. If a search matches 1000 restaurants, returning 25 restaurants starting at offset 100 will return restaurants numbers 100-125 that match the search.. | Integer | optional |
| cuisine | Restrict your search to restaurants that serve a specific cuisine. You must provide a cuisine id. | Integer | optional |
Example Request
- http://www.zvents.com/rest/search_for_restaurants?what=&where=san%20francisco,%20ca&limit=10&cuisine=64&key=YOUR_API_KEY
Response Parameters
The response lists restaurants matching the search terms.
| Parameter | Description | Type | Mandatory |
| id | The unique ID for the venue. | Integer | Y |
| name | The name of the venue. | String | Y |
| description | A description of the venue. | String | |
| creator_id | The ID of the user that created the venue. | Integer | Y |
| link | The URL of the venue page on zvents.com | String | Y |
| url | The external URL of the venue. | String | |
| phone | The phone number of the venue | String | |
| address | The address of the venue | String | Y |
| city | The city of the venue | String | Y |
| state | The state of the venue | String | Y |
| country | The country of the venue | String | Y |
| zipcode | The zipcode of the venue | String | |
| timezone | The timezone of the venue | String | Y |
| latitude | The latitude of the venue | Float | Y |
| longitude | The longitude of the venue | Float | Y |
| hours | Hours of operation for the venue. | String | N |
| tags | A list of tags associated with this venue. | String List | |
| venue types | A list of types for this venue. | String List | |
| images | If this venue has images, this field provides a list of URLs for those images. | String List | |
| search_info | A list of parameters describing the search that was just performed. This information is valuable for examining the default parameters of a search, some of which are fixed and some are contextual. The following values are supplied:
|
Hash |
Example Response
<?xml version="1.0" encoding="UTF-8"?>
<rsp status="ok">
<stream_count>2</stream_count>
<venue id="5813">
<name>Mission Bar</name>
<description></description>
<phone>(415) 647-2300</phone>
<link>http://www.zvents.com/venues/show/5813</link>
<url></url>
<creator_id>2</creator_id>
<address>2695 Mission St.</address>
<city>San Francisco</city>
<zipcode>94110</zipcode>
<state>California</state>
<country>United States</country>
<latitude>37.7539</latitude>
<longitude>-122.419</longitude>
</venue>
<venue id="5795">
<name>Bar 821</name>
<description></description>
<phone>(415) 596-3986</phone>
<link>http://www.zvents.com/venues/show/5795</link>
<url></url>
<creator_id>2</creator_id>
<address>821 Divisadero St.</address>
<city>San Francisco</city>
<zipcode>94117</zipcode>
<state>California</state>
<country>United States</country>
<latitude>37.777</latitude>
<longitude>-122.438</longitude>
</venue>
<search_info>
<sst/>
<set/>
<srss>10</srss>
<what>bar</what>
<when/>
<where>san francisco, ca</where>
<radius>5.0</radius>
<st>venue</st>
</search_info>
</rsp>
Output Fields
Note: The REST API does not return all possible fields for each item by default. Since some response fields are not used by most API users, these fields are suppressed from the response by default in order to reduce latency for the common calls. Additional fields can be enabled in the response using the fields parameters documented in the 'Optimizing API calls for performance' section.
Output Formats
REST responses can be returned in a number of different formats include XML, JSON and CSV. Read the documentation on output formats.
Performance Considerations
For performance reasons, newly created items (events, venues, etc.) will not appear in search results from the REST API for up to an hour after the item was created. It is possible to eliminate this delay when using a commercial API key. Contact support for details.
Possible Errors
This method may return one of the following errors.
- Unrecognized Location: The location string provide in where was not recognized.
- Invalid API Key: The API key supplied is not valid.
- Call Limit Exceeded: The API key has exceeded the daily maximum number of calls.