Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
OpenTable API Client - Visit for details
require "faraday"
require "faraday_middleware"
module OpenTable
class Error < StandardError ; end
module Request
def connection
connection = do |c|
def request(method, path, params={}, raw=false)
headers = {'Accept' => 'application/json'}
path = "/api#{path}"
response = connection.send(method, path, params) do |request|
request.url(path, params)
if [404, 403, 400].include?(response.status)
raise OpenTable::Error, response.body["error"]
raw ? response : response.body
def get(path, params={})
request(:get, path, params)
class Client
include Request
def countries
def cities(country=nil)
def restaurants(options={})
get("/restaurants", options)
def restaurant(id)
Copy link

himanshu-deemtech commented May 6, 2013

is there is any api for open table for getting reviews of business .

Copy link

sethinsd commented Jul 12, 2013

Can you please create a jsonp service, so we can just consume with javascript api without running into cross domain request issues? All you'd have to do is accept an additional argument, 'jsoncallback' and then wrap the data in a function call whose name is specified in that argument, returning content type application/javascript. No need for proxies.

Example jquery usage:
$.getJSON("[YOURDOMAIN]/opentable.php?jsoncallback=?",{,zip:zip}).done(function(data) {
if(data.count>0) {
//process data

opentable.php file:

I'm currently using this, but having to host the php file on my server.

Copy link

mtaylorSF commented Jul 26, 2013

Is there any search available?
send back all restaurants with 7pm reservation for a given date

Copy link

parthasundaram commented Sep 28, 2013

I presume this is just a search API. There are no API's for locking a slot or making a reservation. Correct?

Copy link

mattschoemaker commented Sep 22, 2016

Is there a way to get descriptions back for the restaurants?

Copy link

MohitJarial commented Dec 6, 2017

Is there any search available?
Why does the opentable link show only reservations until 9.30?
I have ref_id and I need to pass datetime and party size parameter into the request so that i can get same results on openTable.Please respond on this soon. .Thanks

Copy link

maneeshrao66 commented Aug 30, 2018

Is there any API to get the customer details who have done a reservation or book a table of particular a restaurant.

Copy link

GaboMendez commented Jun 25, 2020

Hey for all restaurants the image url are not working....

Copy link

luismdz commented Aug 27, 2020

Hi, the restaurants images (image_url) are not working, it shows the same image for all.

Copy link

alanscot commented Sep 5, 2020

Want to query restaurants within a GEO Square, FROM/TO Lat/Long

Copy link

Seb282828 commented Sep 15, 2020

1 - Restaurant image is always the same. Can this be fixed?

2 - Cuisine Type filter doesn't seem available. Is this something that can be added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment