Using Developer Tools

There are multiple developer tool IDEs such as Insomnia, Postman, and Altair. Here are examples using Insomnia and Postman.

Insomnia and Postman are API request IDEs and a sample collection is provided for both tools to get you started. Insomnia also has a remote.it plugin available to assist with authentication to allow you to experiment before you develop code.

For graphQL, you can explore the schema, generate queries and mutations. For the REST-API, you can create http requests.

Insomnia Set Up

Download and Install Insomnia

It is recommended that you install Insomnia Core rather than Insomnia Designer, but the plugin should work for both versions.

Add the Plugin to Insomnia

We will be using a remote.it provided plugin to create queries which will automatically sign the requests.

Go to preferences:

Enter insomnia-plugin-remoteit and click Install Plugin

Remote.it Insomnia Collection

We have developed an example set of GraphQL queries and mutations in a collection that you can import directly into insomnia to get started. You will still need to install the authentication plug-in here and create your access keys in your account before getting started.

You can download our examples here:

$ git clone https://github.com/remoteit/code_samples.git

The collection is found in the api_tools folder.

Here is a quick overview of the UI once you have imported the collection

If you want to start using the API requests in your code, you cannot use the generated code out of Insomnia as the generated signature is only good for that specific request. You will need to use the http request signing methodology. Some examples can be found on the authentication page.

Building a graphQL request on your own

Make sure to create a POST request and select GraphQL Query as Body type. NOTE: All graphQL queries and mutations are made with POST

You can type a sample GraphQL query to https://api.remote.it/graphql/v1 like:

{
  login {
    email
  }
}

If you haven't already set up your machine with the credentials file, see here and do so now.

Select the Auth tab of the query and select Bearer Token authentication.

Click on theToken field and CTRL+Spaceto select the remote.it API authentication tag, and select a specific profile otherwise the default profile will be used.

You now can send the request and execute the query using the credentials stored earlier.

Using graphQL in your application

Once you have your query or your mutation working as you expect, then you can work to integrate it into your application. Examples of request signing can be found here.

Postman Set Up

Download and Install Postman

Remote.it Postman Collection

We have developed an example set of GraphQL queries and mutations in a collection that you can import directly into Postman to get started. Be sure to set up your environment variables before using these.

$ git clone https://github.com/remoteit/code_samples.git

The collection is found in the api_tools folder

Import the environment and collection

You will need to import both the environment file and the collection file.

Update the environment variable values (R3_ACCESS_KEY_ID, R3_DEVELOPER_API_KEY, and R3_SECRET_ACCESS_KEY) retrieved from your credentials file into the Current value field and then "Save" at the top of the variables list.

This is a quick overview of the UI. Please refer to the Postman documentation if yours doesn't look the same as versions may change.

If you want to start using the API requests in your code, you cannot use the generated code out of Insomnia as the generated signature is only good for that specific request. You will need to use the http request signing methodology. Some examples can be found on the authentication page.

Building a graphQL request on your own

A Pre-request Script is required which handles the request signing. The script can be found in the Collection, under the main folder. Any new requests that you create under this collection should inherit this script.

Make sure to create any new request as a POST request and select GraphQL Query as Body type. and use your variable for the url. NOTE: All graphQL queries and mutations are made with POST

You can type a sample GraphQL query to https://api.remote.it/graphql/v1 like:

{
  login {
    email
  }
}

If you haven't already set up your machine with the credentials file, see here and do so now.

Using graphQL in your application

Once you have your query or your mutation working as you expect, then you can work to integrate it into your application. Examples of request signing can be found here.

Last updated