Create a bearer token
-
In order to have data returned when making API calls, a bearer token is required.
-
To create a bearer token, the following call needs to be made:
curl --header "Content-Type: application/json" --request POST -d '{"grant_type" : "password", "credentials" : { "username" : "user" , "password" : "user_password"}}' https://api.campbellcloud.io/v3/campbell-cloud/tokens
NOTE:user is to be replaced by the username for the Campbell Cloud user requesting the bearer token.
user_password is to be replaced by the password associated with the username that is being used.
-
This will return station information similar to what is displayed below.
-
The access token is then used in subsequent API calls via adding an authorization header:
-H "Authorization: Bearer access_token"
NOTE:access_token is to be replaced by the value returned on line 2 in step 3.
-
Please visit https://docs.campbellcloud.io/api/ for further information about refreshing an expired token and offline bearer tokens.