In some cases it can be very convenient to read information from all the accounts in a single query. This is possible for reading public information (behind the public
scope) by using the Client Credentials Flow.
As only public information are returned when using the Client Credentials Flow you will need to make sure that your test accounts have published
rentals as only those ones are returned.
To test the examples of this guide, you will need to authorize at least 2 test accounts.
Use the schema below with by replacing:
CLIENT ID
: Application’s Client IDCLIENT_SECRET
: Application’s Client Secret (do not share, same as password)
https://www.bookingsync.com/oauth/token?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials
Make a POST request to this URL to get your Authentication Token.
Example with CURL:
curl -X POST -d "client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials" "https://www.bookingsync.com/oauth/token"
Sample response:
{
"access_token": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"token_type": "bearer",
"expires_in": 7200,
"scope": "public",
"created_at": 1466671142
}
Note: Tokens (access_token
) are only valid for 2 hours, you then need to request a new one.
Now that you have your access_token
, you can read all the published rentals with the following request.
Do not forget that all responses are paginated.
Example with CURL:
curl --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' https://www.bookingsync.com/api/v3/rentals