Create a bearer token

  1. In order to have data returned when making API calls, a bearer token is required.

  2. 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.

  3. This will return station information similar to what is displayed below.

  4. 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.

  5. Please visit https://docs.campbellcloud.io/api/ for further information about refreshing an expired token and offline bearer tokens.