API V2.0: Difference between revisions

Jump to navigation Jump to search
Line 13: Line 13:


= Authentication =
= 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.
To use most API endpoints you will need to include a token header.


'''Step 1: Get an invite code'''
== Invite codes and refresh tokens ==


Invite codes can be generated here [https://beds24.com/control3.php?pagetype=apiv2 Invite Codes]
'''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]].
For more information about invite codes, [[API_V2.0#Invite_codes|see here]].
Line 23: Line 27:
This step is the only one that must be done manually, all other steps can be performed and automated programmatically.  
This step is the only one that must be done manually, all other steps can be performed and automated programmatically.  


'''Step 2: Get a refresh token using the invite code'''
'''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.
You can use the invite code generated in step one with GET /authentication/setup.


This will return a ''token'' and a ''refresh token''.
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'''
'''Step 3: Use the token to authenticate calls'''


The ''token'' returned in step 2 can be included as a header to authenticate calls to other API endpoints.
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.
 
<span style="color:#019cde; font-size: 150%;“ >{{#fas:info-circle}}  </span>  ''Tokens'' expire after 24 hours.


'''Step 4: Use the refresh token to generate new tokens'''
'''Step 4: Use the refresh token to generate new tokens'''