Read All Authorized Accounts At Once

  1. Preface
  2. Requirements
  3. Getting A Client Credential Token
  4. Read All Published Rentals

Preface

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.

Requirements

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.

Getting A Client Credential Token

Use the schema below with by replacing:

  • CLIENT ID: Application’s Client ID
  • CLIENT_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.

Read All Published Rentals

Now that you have your access_token, you can read all the published rentals with the following request.

Pagination

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