REST API
Partner Agreement Considerations
SinglePlatform's agreement with our partners requires all publishers to update SinglePlatform's data every 24 hours. To do this, our partners make use of our updatedSince parameter in our Search API (api.singleplatform.co/locations/search).
By passing in, as a search parameter, the updatedSince date tag of the previous day, you will be returned a list of all SinglePlatform IDs that have been added or updated in that time period.
- If the SinglePlatform ID returned to you has already been mapped on your side, then we require that you re-ingest and update the existing data for that location and its menu.
- If the SinglePlatform ID returned to you has not been mapped on your side, then we require that you map it to an existing location in your database and ingest the location/menu data accordingly.
- If the SinglePlatform ID returned to you has not been mapped on your side, and you are unable to find a match in your database, then we require that you add the location to your database and ingest the location/menu data accordingly.
Matt Doumar (mdoumar@singleplatform.com), our product lead, will be available to work with our partners' dev teams to ensure the process of matching / updating / adding locations is as straightforward as possible and in compliance with SinglePlatform's partner agreement.
General API Information
Content Types
The SinglePlatform REST API is a well-behaving API that returns results according to the requested content type. Use the Accept
header in a request to indicate you want the result in a specific format.
Default Content Type
Except where noted, the default content type of all responses in the API is text/html
.
Accepted Content Types
The content types currently understood by much of the API includes:
text/html
application/json
If a URI responds to a differing set of content types, that URI's definition includes the list of content types to which it responds.
Request Header
What is always accepted in the headers:
- Referer
- User-Agent
- Accept
- Content-Type
For specific URIs, other required or optional headers may be defined.
Response Header
What is commonly returned in the response headers:
- Content-Type
For specific URI responses, other response headers may be defined.
Default Response
Unless otherwise noted, the default response from an action is a text/html
document with the following fields:
code
: Matches the HTTP response code.status
: The Message associated with the HTTP response code.ok
: Either"true"
or"false"
, if the HTTP response code is in the 2xx family.
To receive a document in another format, that format must be specified in the Content-Type
request header.
API Key Use
Unless otherwise noted, all API requests for HTML data should be accompanied by your API Key.
For details about what is the API Key and how you can obtain it, see: API Key.
Authentication Requirements
Unless otherwise noted, all API requests for JSON data require the request to be authenticated using your Client ID and Signing Key.
For details about how to acquire and use them, see API Authentication.
URIs
URI: /locations/search
The search URI should be used to find any locations available for your use.
GET
Request
Headers:
Accept
: takes one of:application/json
Parameters:
q
: The query string. A free-form query, it searches in the following ways (NOTE: blank queries return nothing):- by phone number in one of these forms: 10 sequential digits; with dash or period separators (ex: XXX-XXX-XXXX)
- by zip code in one of these forms: 5 digit zip, 9 digit zip with dash (ex. 10001-4356)
- by name of location
page
: The page number. A zero-based value. The default value is 0 for the first page.count
: The number of results per page. The default value is 20, and the maximum value is 1000.updatedSince
: Filter the results to list only those locations updated since the specified date.- Format: YEAR-MONTH-DAY
- Example:
- 2012-01-05
- 2012-01-05
URI Examples:
The following two example URIs are equivalent and return the first 20 of the available locations as the 0th page of locations.
/locations/search /locations/search?q=&page=0&count=20
An example query URL that returns the third page of results for all locations with Haru
in the name:
/locations/search?q=Haru&page=3&count=100
The following example returns the first 20 of the locations updated since January 18, 2012 at 2:03 pm as the 0th page of locations.
/locations/search?updatedSince=2012-01-18
Response
The JSON response contains the following information:
- A map of:
query
: The original query line sent to the search engineok
: true if the search was a success. false if the search was not a success. If the search was a success but no results were found, this value is true.page
: Which page these results are on, should match the original query (or be 0 if not defined in the original query)count
: Number of results per page, should match the original query (or be 20 if not defined in the original query)total
: The full number of results that the search have matched; can be used to calculate total number of pagestime
: The date/time when the query was performed in Eastern Standard Time (EST).results
: A list of maps, each is a location with the keys as defined in Location Field Descriptions.
URI: /locations/LOCATION
In the URI, LOCATION should be replaced by the ID of the location. For example, the ID for Haru might be haru-7
and the URI would be /locations/haru-7/
GET
Request
Headers:
Accept
: takes one of:application/json
Response
Returns the set of information for the location as defined in Location Field Descriptions.
0 Comments