updated June 2020
Hello Thunkers!
So today I want to show you how to implement OpenTable Unofficial API to Thunkable
OpenTable is the world’s largest online restaurant-reservation service!
Note: there is a limit of 1000 requests per hour per IP address. Also there is no API key.
Single Restaurant Data
Using your WebAPI component, you can get a single restaurant data. To do that, set your Web component’s URL parameter to this url: http://opentable.herokuapp.com/api/restaurants/YOUR_RESTAURANT_ID
Note: replace YOUR_RESTAURANT_ID with your own restaurant id!
Then use WebAPI component’s function GET. After that you gonna get a response in JSON format. Then all you gonna have to do is to parse the data you got with the Objects blocks.
This is an example restaurant response for restaurant id 107257:
{ "id": 107257, "name": "Las Tablas Colombian Steak House", "address": "2942 N Lincoln Ave", "city": "Chicago", "state": "IL", "area": "Chicago / Illinois", "postal_code": "60657", "country": "US", "phone": "7738712414", "lat": 41.935137, "lng": -87.662815, "price": 2, "reserve_url": "http://www.opentable.com/single.aspx?rid=107257", "mobile_reserve_url": "http://mobile.opentable.com/opentable/?restId=107257", "image_url": "https://www.opentable.com/img/restimages/107257.jpg" }
Here are the blocks you need to show this response:
If you want to show a specific property, for example postal_code
, all you need to do is convert the JSON response to an object, like this:
List All Cities
Using your WebAPI component, you can get a list of all cities available. To do that, set your WebAPI component’s URL parameter to this url:
http://opentable.herokuapp.com/api/cities
Then use WebAPI component’s function GET. After that you gonna get a response in JSON format.
Then all you have to do is to parse the data you got with the Objects blocks.
This is an example response:
{ "count": 1234, "cities": [ "Chicago", "San Francisco", "New York" ] }
Get Data Stats
Using your WebAPI component, you can get stats for the OpenTable API. To do that, set your’s Web component’s URL parameter to this url: http://opentable.herokuapp.com/api/stats
Then use Web component’s function GET. After that you gonna get a response in JSON format.
Then all you gonna have to do is to parse the data you got with the Objects blocks.
This is an example response:
{ "countries": 20, "cities": 2700, "restaurants": 25000 }
Multiple Restaurants Data
To get multiple restaurants data set Web Component’s URL to http://opentable.herokuapp.com/api/restaurants?PARAMETER=VALUE
Note:
Change PARAMETER with one of these: price; name; address; state; city; zip; country; page; per_page.
And replace DATA with your own data. i.e city=chicago
will return a list of restaurants in Chicago.
After that, just use function GET and parse result with the Objects blocks.
{ "count": 521, "per_page": 25, "current_page": 1, "restaurants": [ ... ] }
Thank you! If something goes wrong, I can help you!
Remix
Here’s the remix link if you want to try customise this project for yourself:
https://x.thunkable.com/copy/92020465237a54ae9fe475fb333c6c58