Insomnia REST API Workspace,
This guide is for developers who have familiarized themselves with Platform of Trust Sandbox and APIs and have started trying them out using a REST API client tool like Insomnia.
In previous guides, you have gained adequate knowledge about how Platform of Trust core APIs function using Insomnia workspace. You have been able to create your identity network, data products, and then application.
In the guide, we talked about Insomnia Workspace tool. You can use the workspace to send requests to Platform of Trust Broker API for consuming data via a created Data Product. Let's see now how easy it is to consume data using the plugin for handling Platform of Trust Broker API signature. This plugin computes and adds an X-Pot-Signature header to
/broker/v1/fetch-data-product requests sent from Insomnia REST Client.
Note: Keep in mind, that this Insomnia Workspace is designed to support only Version 1 APIs from Platform of Trust.
As you may have discovered in Broker API documentation, request
/broker/v1/fetch-data-product needs to have 2 required properties in header:
The signature is created from the request payload and the application's client secret.
You can find in the Insomnia Workspace how header is already setup:
When you have created Application using Application API , you have received client secret and application token. Setup those values for client_secret and app_token in Sandbox environment of Insomnia Workspace.
2. Type npm-package-name: "@platform-of-trust/insomnia-plugin-platform-of-trust"
3. Click Install plugin
4. Click Enable and you should see plugin is enabled
Now X-Pot-Signature property from header of Broker request is setup and you can try consume data through Broker API.
If you face some issues to install the plugin, (e.g.
Yarn error warning @platform-of-trust/insomnia-plugin-platform-of-trust > firstname.lastname@example.org: jsSHA versions < 3.0.0 will no longer receive feature updates), you can install the plugin manually by npm then copy that to the Insomnia plugin folder.
$ npm install @platform-of-trust/insomnia-plugin-platform-of-trust
Body of request
/broker/v1/fetch-data-product requires few parameters, some of them specific to the translator used when you created data Product.
See an example of consuming data product which has been created previously with a sample translator :