How to Authenticate My Application with Doohickey Cloud Services API
Before You Start
Before you start, make sure you've done the following:
- Request an account for Doohickey Cloud Services
- Have your username, password, and account name ready
Step-by-Step Guide
Step 1: Create login request
To login to Doohickey Cloud Services, you need to first create a login request and get an JWT token. You can do this by making a POST request to the login endpoint.
curl --location --request POST 'https://api.blendededge.com/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "{{username}}",
"password": "{{password}}",
"accountName": "CompanyName"
}'
Step 2: Copy id_token from the response
You will receive a JSON response with acess tokens similar to the example below:
{
"tokens": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"id_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"expires_in": 1651606166
}
}
Copy the id_token from the response for use in the next step.
Step 3: Send request to Doohickey Cloud Services
Now that you have an id_token, you can send a request to Doohickey Cloud Services. Let's use the token to retrieve a list of integration definitions for the account. The id_token should be sent in the Authorization header as a Bearer token.
curl --location --request GET 'https://api.blendededge.com/definitions' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
If the request was successful you should receive an array of integration definitions. If no integration definitions are found, you will receive an empty array. As long as you receive an array, the request was successful.