with Postman
A quick showcase of how Postman can be used to explore the various calls available on our REST API.

Overview

We will here show how Postman can be used to interact with our REST API. As an example, Basic Auth will be used to authenticate a GET request that fetches a list of available projects and a POST request that creates a new label for a device. All available endpoints are listed in our REST API Reference.

Prerequisites

Postman

Postman is a collaboration platform for API development. It is a powerful tool with many useful features, but we will here use it to make simple arbitrary HTTP requests.

Installation

Postman can be acquired from the official downloads page.

Authorization

When creating a new request, under the Authorization tab, specify the method of Basic Auth.
    Username: Your Service Account Key ID.
    Password: Your Service Account Secret.

GET Request

To fetch a list of all projects available to a Service Account, create a new GET request with the following endpoint URL. No request body is required for this call.
https://api.d21s.com/v2/projects
If the valid key-id and secret of a Service Account with sufficient privileges were used, Postman should return a list of the available project for that account.
1
{
2
"projects": [
3
{
4
"name": "projects/<PROJECT_ID>",
5
"displayName": "wCaV7Y",
6
"organization": "organizations/<ORGANIZATION_ID>",
7
"organizationDisplayName": "Disruptive Technologies Research",
8
"sensorCount": 10,
9
"cloudConnectorCount": 1,
10
"inventory": false
11
}
12
],
13
"nextPageToken": ""
14
}
Copied!

POST Request

To add a new label to a device, create a new POST request with the following endpoint URL.
https://api.d21s.com/v2/projects/<PROJECT_ID>/devices/<DEVICE_ID>/labels
For the body, choose Raw and then JSON. Within, the label name and value should be provided.
If the valid key-id and secret of a Service Account with sufficient privileges were used, Postman should return the name, key, and value.
1
{
2
"name": "projects/<PROJECT_ID>/devices/<DEVICE_ID>/labels/my-new-label",
3
"key": "my-new-label",
4
"value": "some-value"
5
}
Copied!
Last modified 2mo ago