Generate RMS Connect link API example

From Teltonika Networks Wiki
Revision as of 15:30, 6 June 2022 by PauliusRug (talk | contribs) (first draft)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)

Introduction

Using the RMS API allows users to automate tasks and integrate RMS into their own solutions. In this guide, an example will be provided which step-by-step shows a way to apply the RMS API to create and fetch RMS Connect links.

Such application could be used to integrate RMS connect link generation into your own solution, which would allow to access devices faster and from a native device control solution.

All documentation of the RMS API can be found here - https://developers.rms.teltonika-networks.com/

This example only includes using Personal Access Tokens to use the API. The RMS API also allows for Application Authentication, used specifically in applications that can use RMS as an OAuth provider.

Two-Factor Authentication


Firstly, to create a Personal Access Token, your account must have Two-Factor Authentication enabled.

This can be done by going to your RMS Account settings and then the Security page. Any Authentication type (other than None) is viable.

Once Two-Factor authentication is enabled, you can then head over to the API → Access tokens page of your Account settings to begin creating a Personal Access token.


Add new access token


Once there, simply press Add new access token.


Next, input a name for this access token and select the necessary Scopes. Scopes are basically permissions – what the access token will be capable of doing in your account. For this example, we will be selecting these scopes:

  • devices:read
  • device_remoce_access:read
  • device_remoce_access:write


This will give the specific RMS API token the rights to read information about devices, create and read information about RMS connect devices. After selecting the necessary scopes, press Save Personal Access Token – you will be shown a table containing your Personal Access Token. WARNING: This is the only time the created access token will be shown, make sure to copy it, as you will not be able to see it again.


Now that we have the access token, we can now use the RMS API. All information about each API endpoint can be found in the API reference.

There are multiple ways to use an API, for this example, we will be using Postman.

Setting up Postman

To start using post efficiently you can download the RMS API Reference YAML file which you will be able to upload to your Postman desktop application by simply clicking the import button in the desktop app and then uploading the downloaded YAML file.


Adding RMS API access token to Postman

After that, you will be able to set authorization for RMS API from Postman. To do this:

  1. Click on the API's button;
  2. Select "RMS API" from the list;
  3. Go to "Authorizations" tab;
  4. Select Type as "Bearer Token";
  5. Enter your saved RMS API token to the Token field;


Setting up authorization for API calls

This will allow us to copy in only one Bearer toke, which API calls will be able to inherit. To set this up, whenever you open a new API call, go to Authorization tab and select the Type as "Inherit from parent".


Searching for API calls

To follow this configuration example more easily, you can search for all of the API calls in the list:

Getting the device ID in RMS

To get the ID of the device, for which we will want to generate RMS connect remote accesses and generate link for them, we first need to execute