Back to top
Vastuu Group

Insomnia Plugin for Platform of Trust

Last updated: March 16, 2021
|
Reading time: 3 min

Tags: V1 APIs, Insomnia REST API Workspace, Plugin

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.

Learn more about Broker API in the API profile in Developer Portal.

To follow this guide, it is important that:

Get Insomnia Workspace for Platform of Trust

Note: Keep in mind, that this Insomnia Workspace is designed to support only Version 1 APIs from Platform of Trust.

Broker API

As you may have discovered in Broker API documentation, request /broker/v1/fetch-data-product needs to have 2 required properties in header:

  • X-App-Token and
  • X-Pot-Signature.

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:

insomnia-broker-header.png

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.

insomnia-environment-setting.png

Read more about Application API from Developer Portal.

Setup plugin

1. Go to Application > Preferences > Plugins

insomnia-plugin.png

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

insomnia-broker-plugin.png

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 > jssha@2.4.2: 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

Consume data product using Insomnia Workspace

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 :

insomnia-call-broker-api.png

Conclusion

Now you will be able to use the Insomnia workspace to make direct calls to the Broker API with the aid of this Plugin. This aims to reduce the complexities of generating X-Pot-Signature and making a request to the Broker API at the same time using a python script.

Get the Insomnia Plugin for Broker API

Ready to explore more?

Try Platform Sandbox

Improvement Suggestions? or a New Guide?

Tell us in GitHub