ADT: Azure Digital Twins
Postman is a REST testing tool that provides key HTTP request functionalities in a desktop and plugin-based GUI. You can craft HTTP requests and submit them to the Azure Digital Twins (ADT) REST APIs.
This blog describes how to configure the Postman REST client to interact with the ADT APIs (creating a request collection).
Prerequisites
knowledge about ADT
Postman installed
.NET Core installed (optional)
Azure DT instance created
Azure DT test models and graphs created and uploaded
Table of content
Using Azure CLI
Using Postman
Create your own ADT collection
Add an individual request
Set request details
Getting Started
Using Azure CLI
1. Run the following command to access Azure credentials:
az login
2. Run the following command to get a bearer token with access to the ADT service.
using data plane APIs:
az account get-access-token --resource 0b07f429-9f4b-4714-9392-cc5e8e80c8b0
using control plane APIs:
az account get-access-token --resource https://management.azure.com/
result example:
"accessToken": "eyJ0eXAiOiJ..."
"expiresOn": "2022-07-2...",
"subscription": "907b0d06-a...",
"tenant": "24ab6cd0-487e-...",
"tokenType": "Bearer"
Save the value of the accessToken and we will use it later on.
Using Postman
We can either create our own collection of ADT APIs or import an existing one. This article will be talking about creating one from scratch.
Create your own ADT collection
In
My Workspace
clicknew
to create a newCollection
in Building Blocks. Change the collection name if you like.In the
Authorization
tag, set theType
to OAuth2.0 and paste your access token into the Token box. Click save.
Add an individual request
In
My Workspace
clicknew
to create a newRequest
in Building Blocks.By clicking the
Save
button, you can name the new request and select a collection to save it. Click save again.
The new request
Query twins
was saved inADT Custom Collection
directory.
Set request details
Change the type from GET to POST, and paste the URL below:
https://digitaltwins-host-name/query?api-version=2020-10-31.
Using your own digital-twins-host-name
In the Authorization tab, set the Type to Inherit auth from parent
.
Check that the body shown for the request in the Body tab matches the needs described below:
Use send
button to send the request.
OK! All set.
References
https://docs.microsoft.com/en-us/azure/digital-twins/how-to-use-postman?tabs=data-plane
Cover image from this link
https://aithority.com/computing/5-exciting-applications-of-digital-twin-technology/
Top comments (0)