Introduction
The APIs can be used to fetch logged values and to list machines, controllers and tags. You first need to create an API key to be able to access the API. To authorize an API request, you need to create an API key as described in the Authorization section below.
Nodes
Every group
or machine
has a corresponding nodeId
. A nodeId
can often be
used to filter API results. In most cases if the nodeId
is a group
, results
are returned for all groups
and machines
beneath it in the hierarchy.
Authorization
To authorize an API request you first need to create an API key. As a system administrator you can create one in the portal using the API keys view. This view is accessible from the User Management
menu in the left sidebar.
-
Click
New key
and fill in the form. -
When created you will receive a
key
and asecret
. Make sure you store these in a safe place, since the secret cannot be retrieved again.These fields need to be passed in the headers with each API request.
"apikey": <key>, "apisecret": <secret>
-
In order to use the API locally on the gateway, together with the new API key, the configuration must first be sent to the gateway.
-
Fetching all machines using cURL can look like this.
curl -H "apikey: <key>" -H "apisecret: <secret>" 'http://<GatewayIp>/api/v1/twins'
Local and cloud APIs
The APIs exist both locally on the gateway and in the cloud. It is preferred to access the APIs on the gateway, due to heavier throttling in the cloud.
Local API
The local API uses the HTTP scheme where the host name is the IP address of the gateway, e.g. 192.168.2.1
. The local API is available on both network interfaces on the gateway.
http://<GatewayIp>/api/v1/machines
Cloud API
The cloud API uses the HTTPS scheme where the host name is portal.connectitude.com
.
https://portal.connectitude.com/api/v1/machines