Insomnia

Updated: June 12, 2020
Contents

Introduction

Insomnia – RoaringAppsInsomnia is a free cross-platform desktop application that takes the pain out of interacting with HTTP-based APIs. Insomnia combines an easy-to-use interface with advanced functionality like authentication helpers, code generation, and environment variables
It can be downloaded from www.insomnia.rest.

This tutorial describes how to use the Connect API with Insomnia.

Prerequisites

Before making an API call to Connect, create an API key in Connect. Follow the instructions in Creating API Tokens to create a token with type “Custom” and copy the token by using the Copy icon on the Tokens screen.

Note the API endpoint value on the Extensions > General screen:

Importing the API specification

Insomnia has the following two concepts of organizing the data:

  • Environments: The data for the API calls (e.g. the API keys). In the example below, the Environment will hold the value of {{ base_url }} placeholder.
  • Workspace: The collection of API methods with placeholders, for example:
    GET {{ base_url }}/assets call will retrieve all Assets

Importing Workspace

First, download the API specification from our OpenAPI specification page. After that, open Insomnia and click on the arrow next to Insomnia name. Then, select “Import/Export“:

In the opened dialog click “Import Data” > “From File“:

In the File Open dialog window, navigate to the .yml file with the API specification, click Import

After the workspace import is complete, click “No environment” > “Manage Environments

In the “Manage Environments” window set the content of “OpenAPI env” to the following: TODO check once API public

{
  "apiKey": "<API key from previous section>",
  "base_path": "/public/v1",
  "host": "api.connect.cloudblue.com",
  "scheme": "https"
}

And click “Done“.

Making a sample call

To make the first API call, in the main Insomnia screen expand the Assets folder on the left and click on “GET /assets“. Then, click “Send

The result of the API call will appear at the right side of the Insomnia window.

More Information

For more information, please refer to the Getting Started with Insomnia.

Is this page helpful?
Translate with Google
Copied to clipboard