Documentation
The documentation site is your starting point for all things related to working with mySeat.
Updated on wed, 2011-12-11 13:45
Getting started with mySeat
Plugins
REST API
The mySeat API is another way to access your reservation data — one that makes it easy for third-party tools to interact with mySeat. The API follows the REST conventions. This guide should provide everything you need to implement software that works with mySeat.
What's an API?
The acronym "API" stands for "Application Programming Interface". An API is a defined way for a program to accomplish a task, usually by retrieving or modifying data. In mySeat's case, we provide an API method for getting the most used reservation data. Programmers use the mySeat API to make applications, websites, widgets, and other projects that interact with mySeat. Programs talk to the mySeat API over HTTP, the same protocol that your browser uses to visit and interact with web pages.
Call limits
There are limits to how many calls you can make in a day. API usage is rate limited to protect mySeat from abuse.
The standard limit is set to '1000' calls. It can be changed in the file api/1/rest.class.php.
The API is entirely HTTP-based
Methods to retrieve data from the mySeat API require a GET request. All calls that require a HTTP GET method will return a HTTP Response Codes if you do not make your request with the correct one. You will retrieve results in the JSON format.
API calls expectations
Some API methods take optional or requisite parameters. Two things to keep in mind when making requests with parameters:
- The typical URI is
http://www.mywebsite.com/mysubfolder/api/1/followed by the ressource and parameters. - The '1' in the URI shows the api version.
- Parameter values should be converted to UTF-8 and URL encoded.
- The API is accepting
GETmethods only at the moment.
API Token
This parameter tells mySeat API who you are, so it's mandatory on each call. Keep your API token key secret.
You can obtain a API token at http://www.mywebsite.com/mysubfolder/api/index.php.
Delete the api/index.php file if you do not want to use the API!
Call results
You will retrieve results in the JSON format. The API always returns 'status', with 'code' and 'status', and 'response', containing the requested data itself. Please see the example result.
Notice
Go easy on the API. Cache data where you can, respond to error messages, and be thoughtful about your user experience.
Example Request
| GET | http://www.openmyseat.com/api/1/reservations/json.php?outletID=2&selectedDate=2011-11-01&token=f2b88cd6c9fd796b0f1c43a5cb88e |
REST API Resources
Timelines are collections of Tweets, ordered with the most recent first.
| Resource | Description | |
|---|---|---|
| property/json.php | Returns the property detail information. The property is specified using the propertyID parameter. | |
| Parameters | ||
| propertyID | The numerical ID of the desired property. Default value is '1'. Example Value: 3 | token | Your personal API token. Example Value: f2b88cd6c9fd79ad6b0f1c43a5cb88edc169da2effe8 |
| outlets/json.php | Returns the outlet detail information. The outlet is specified using the outletID parameter. | |
| Parameters | ||
| propertyID | The numerical ID of the desired property. Default value is '1'. Example Value: 3 | |
| outletID | The numerical ID of the desired outlet. Example Value: 5 | |
| year | The year in which the outlet is open. Date should be formatted as YYYY. Default value is the actual year. Example Value: 2011 | token | Your personal API token. Example Value: f2b88cd6c9fd79ad6b0f1c43a5cb88edc169da2effe8 |
| guest_info/json.php | Returns information about a single guest. The guest is specified using the name parameter. | |
| Parameters | ||
| name | A full guest name, which is URL encoded. Example Value: Norris, Chuck | |
| token | Your personal API token. Example Value: f2b88cd6c9fd79ad6b0f1c43a5cb88edc169da2effe8 | |
| guest_show/json.php | Returns information about multiple guests. This method is very similar to guest_info/json.php except you can get a list of guests to view. | |
| Parameters | ||
| outletID | The numerical ID of the desired outlet. Example Value: 5 | |
| startDate | Returns guests reserved after the given date. Date should be formatted as YYYY-MM-DD. Example Value: 2011-01-31 | |
| endDate | Returns guests reserved before the given date. Date should be formatted as YYYY-MM-DD. Value must be greater than startDate. Example Value: 2011-01-31 | |
| status |
Specify the guest status of the query. Allowed guest status are HG,PASS,WALK or ALL. Default value is ALL. Example Value: PASS
|
|
| token | Your personal API token. Example Value: f2b88cd6c9fd79ad6b0f1c43a5cb88edc169da2effe8 | |
| reservations/json.php | Returns the reservations of a specific outlet and date. | |
| Parameters | ||
| outletID | The numerical ID of the desired outlet. Example Value: 5 | |
| selectedDate | Specify the given date. Date should be formatted as YYYY-MM-DD. Example Value: 2011-01-31 | |
| token | Your personal API token. Example Value: f2b88cd6c9fd79ad6b0f1c43a5cb88edc169da2effe8 | |
| availability/json.php | Returns if a reservation of a dedicated number of guests can be taken. Response codes Seats available: 202 Seats not available: 406 Day off: 403 |
|
| Parameters | ||
| propertyID | The numerical ID of the desired property. Default value is '1'. Example Value: 3 | |
| outletID | The numerical ID of the desired outlet. Example Value: 5 | |
| selectedDate | Specify the given date. Date should be formatted as YYYY-MM-DD. Example Value: 2011-01-31 | |
| time | Specify the given time. Time should be formatted as 24h format HH:MM. Example Value: 20:00 | |
| pax | Specify the number of guest of party. Example Value: 4 | |
| token | Your personal API token. Example Value: f2b88cd6c9fd79ad6b0f1c43a5cb88edc169da2effe8 | |
Example result
Results for a property GET request.
{
"status": {
"code": 200,
"status": "OK"
},
"response": {
"property": {
"id": "1",
"name": "Brenners Park-Hotel&Spa",
"street": "Schillerstrasse 6",
"zip": "76834",
"city": "Baden-Baden",
"country": "DE",
"contactperson": "Restaurant Manager",
"phone": "+49 (0) 7221/9000-0",
"fax": "+49 (0) 7221/9000-41",
"email": "info@brennerscom",
"website": "www.brennerscom",
"created": "2011-11-11 10:11:15",
"img_filename": "LEx1FB52iMvQqWz86peGXKyg.jpeg",
"logo_filename": "B75reuMKpw6zF8yfjcPN1XiV.gif",
"status": "active",
"social_fb": "https://www.facebook.com/BrennersParkHotel",
"social_tw": "https://twitter.com/#!/BrennersPark"
}
}
}
Responses and Errors
All response codes are included in the HTTP Status response header. Possible status codes include:
- 200: OK (upon a successful GET request)
- 202: Accepted (upon a successful availability request)
- 204: No Content (requesting a non-existent outlet, reservation, or other resource)
- 400: Bad Request (improperly-formatted request)
- 401: Unauthorized (incorrect or missing authentication credentials)
- 403: Forbidden (upon an declined availability request - day off)
- 406: Not Acceptable (upon an declined availability request - fully booked)
Example usage
Example usage in PHP.
// the URI we want to execute from the API
$service_url = 'http://www.example.com/api/1/property/json.php?propertyID=1&token=f2b88cd6c9fdv';
// create the curl handle
$ch = curl_init();
// setting several options like url, timeout, returntransfer
// the url
curl_setopt($ch, CURLOPT_URL, $service_url);
// the timeout
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// returntransfer, put result in a variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// get the content of the url and put it into the output variable (thanks to the returntransfer option)
$result = curl_exec($ch);
// decode JSON result to PHP array
$output = json_decode($result);
// Example print the result array
print_r($output);
// example of storing the API result status code in variable
$status = $output->status->code;
// close the curl handle to free system resources
curl_close($ch);
Contacting mySeat's API Support Team
If you have a specific question about the API, please contact us at developer@myseat.us.
Developers