Authentication
CampbellCloudAPI access is strictly controlled through Bearer Authentication, requiring a bearer token to be included with every API call. Bearer token authorization follows a two-step process:
-
The client must first request a Bearer token.
-
The obtained token is then used to authenticate subsequent API calls.
Since the Bearer token has a limited lifespan and expires after a set period, it must be refreshed periodically. The first API request should always retrieve a Bearer token before making further calls.
For example:
POST https://iot.campbell-cloud.com/api/v1/tokens
{
"username": "{authUsername}",
"password": "{authPassword}",
"client_id": "cloud",
"grant_type": "password"
}
In the preceding path segments, the user would enter their username and password credentials for their CampbellCloud account User account.
If valid, a response similar to the following would be provided:
Status Code:
200 OK
JSON Response:
{
"access_token": "",
"expires_in": 3600,
"refresh_expires_in": 1800,
"refresh_token": "",
"token_type": "Bearer",
"not-before-policy": 0
}
The actual bearer token and refresh token have been removed from the preceding response.
You can test using the CampbellCloud API by using the Demo User authentication details to access data from the CampbellCloud Demo Organization. Please use the following authentication details for accessing the Demo Network:
-
URL https://iot.campbell-cloud.com
-
Username demo@campbell-cloud.com
-
Password c^T9m4A4*!tyPu9q
-
Organization ID 867e3a14-7614-47a2-a5fa-73e831cfc170
Please now refer to the CampbellCloud API documentation at the following link for specific information on supported API calls.