API V2.0: Difference between revisions
Jump to navigation
Jump to search
Sorenjensen (talk | contribs) No edit summary |
Sorenjensen (talk | contribs) No edit summary |
||
| Line 11: | Line 11: | ||
More information can be found here [https://beds24.com/api/v2 beds24.com/api/v2] | More information can be found here [https://beds24.com/api/v2 beds24.com/api/v2] | ||
= Authentication = | |||
There are two kinds of tokens, long life tokens which have read only access, and refresh tokens which generate tokens that can read and make changes. | |||
To use most API endpoints you will need to include a token header in the format "token: {token}" | |||
== Invite codes and refresh tokens == | |||
'''Step 1: Get an invite code or long life token''' | |||
Invite codes and long life tokens can be generated here [https://beds24.com/control3.php?pagetype=apiv2 Invite Codes] | |||
For more information about invite codes, [[API_V2.0#Invite_codes|see here]]. | |||
This step is the only one that must be done manually, all other steps can be performed and automated programmatically. | |||
'''Step 2: If using an invite code, get a refresh token''' | |||
Skip this step if using a long life token | |||
You can use the invite code generated in step one with GET /authentication/setup. | |||
This will return a ''token'' and a ''refresh token''. | |||
<span style="color:#019cde; font-size: 150%;“ >{{#fas:info-circle}} </span> ''Tokens'' generated from refresh tokens expire after 24 hours. | |||
'''Step 3: Use the token to authenticate calls''' | |||
The ''token'' (either a long life token or a token generated using a refresh token) can be included as a header to authenticate calls to other API endpoints. | |||
'''Step 4: Use the refresh token to generate new tokens''' | |||
As ''tokens'' expire after 24 hours, you will need to use the ''refresh token'' with GET /authentication/token to get new tokens when old ones expire. | |||
<span style="color:#019cde; font-size: 150%;“ >{{#fas:info-circle}} </span> ''Refresh tokens'' do not expire so long as they have been used within the past 30 days. | |||
= Invite codes = | = Invite codes = | ||
| Line 108: | Line 141: | ||
The "all" method may be used as a shortcut to grant access to all methods. For example "all:bookings" would allow for the reading, updating, creating and deleting of bookings. | The "all" method may be used as a shortcut to grant access to all methods. For example "all:bookings" would allow for the reading, updating, creating and deleting of bookings. | ||
= POST requests = | = POST requests = | ||