Search API
HTTP Location
{API BASE}/search/restaurants
{API BASE}/search/menuitems
Parameters
| PARAMETER NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| lat | Decimal | Yes | Latitude to search around |
| lon | Decimal | Yes | Longitude to search around |
| tags | String | No | Tags to restrict the search by. Separate multiple tags with a space (URL encoded to a +, so your GET request would have something like: tag1+tag2). |
| limit | Integer | No | Places a limit on the number of results returned. Defaults to 10. Maximum of 50. |
| skip | Integer | No | If provided, skips that number of results from the top. Used to provide paging support (get next 10 items…). |
| sort | String | No | Sorts the results by the given field. Acceptable values: distance, price. Default is by distance. |
| q | String | No | This is a fuzzy search parameter. It does a weighted full-text search on item values. |
| name | String | No | The business or menu item name to search for. Does a trailing-wildcard search (“b” matches “b*”). |
| show_closed | Integer | No | Either 0 or 1. By default, the search hides closed restaurants and unavailable menu items. Specify 1 to see these items in the search results. |
Example
http://api.opendining.net/search/restaurants?lat=40&lon=-81&q=burrito
Results
The following table lists the properties of the search results object.
| PROPERTY NAME | TYPE | DESCRIPTION |
|---|---|---|
| count | Integer | The number of results found. |
| results | Array (of result objects) | The search results. |
| facets | Object | An object listing the applicable search facets. |
Results Array
Searches return either restaurants or menu items. The following tables list the properties of the items contained in the search results array. Because many properties are used by both restaurants and menu items, they have been consolidated into a single table.
Common Result Properties
| PROPERTY NAME | TYPE | DESCRIPTION |
|---|---|---|
| id | String (Mongo ID) | ID of the result. |
| name | String | Name of the result. |
| distance | Decimal | Distance from the center of the search. |
| lat | Decimal | Latitude of the result. |
| lon | Decimal | Longitude of the result. |
| address | String | Address of the applicable restaurant. |
| city | String | City of the applicable restaurant. |
| state | String | State of the applicable restaurant. |
| zip | String | Zip code of the applicable restaurant. |
| phone | String | Phone number of the applicable restaurant. |
| website | String | The restaurant’s website. |
| org | String (Mongo ID) | The restaurant’s organization. |
| image_url | String | The Image URL from the menu item or restaurant. |
| description | String | The item’s description. |
Restaurant Result Properties
None at the moment.
Menu Item Result Properties
| PROPERTY NAME | TYPE | DESCRIPTION |
|---|---|---|
| prices | Array (of price objects) | The prices array from the menu item. See menu item documentation for more information. |
Facets
Search facets list information used to “drill down” into search results, such as tags, and price ranges. This lets you give the user a list of options for refining their search results.
For example, if you do a search for restaurants, and there are 11 restaurants tagged with “italian” and 14 tagged with “mexican”, you would get the following “tags” facet object.
"facets": {
"tags": {
"italian": 11,
"mexican": 14
}
}
You could then supply the “tagws” parameter to another search if the user selected one of these facets to drill down on. We currently perform faceting on the following properties, with more to come:
- Tags