Learning Center

Integration of data on Tekon IoT Platform by REST API - Anatomy of a Request

The Tekon IoT Platform allows the integration of data through REST API. The communication between client and server is performed with a request formed by 4 elements:

    •  Endpoint;
    •  Method;
    •  Header;
    •  Body (data);

 

Endpoint

The endpoint is the URL to which the request is directed. In the case of the Tekon IoT Platform, it consists of the concatenation of the instance address and the api/datasourceData/apikey/

Example:

https://iot19.tekonelectronics.com/api/datasourceData/apikey/


Method

The method is the type of request sent to the server. Since the main intended action is to send data, the method used is POST. Using this method, a register is created in the database and an answer with the information, success or error, is returned if the data has been accepted or rejected. The type of answers returned can be found in the topic "Status Codes and Error Messages".


Header

Within the header, some relevant information is carried to the server. The following parameters must be sent in the header:

Content-Type: application/json

Indicates to the server that the type of content is in JSON format.

datasourceApiKey: {datasource_api_key}

The field {datasource_api_key} matchs to the API Key associated to the Tekon IoT Platform datasource, to which the data will be sent.

userApikey: {user_api_key}

The {user_api_key} field matchs to the API Key associated to the user.

The data for the datasourceApiKey and userApikey parameters are provided by the Tekon IoT Platform.

Example:

Content-Type: application/json
datasourceApiKey: 97522f70-a9d2-4909-a345-eb27d7681a35
userApikey: 18b68771-e8bc-47c0-88fc-a16f631fcf98


Body(data)

The body contains the data you want to send to the server. The sent data must have the following example structure:

{
   "TimestampMilliseconds": 1526034198371,   // optional
   "VariablesData": [
      {"VariablePosition":1,"Value":3},
      {"VariablePosition":2,"Value":1},
      {"VariablePosition":3,"Value":-34},
      {"VariablePosition":4,"Value":10},
      {"VariablePosition":5,"Value":1},
      {"VariablePosition":6,"Value":9},
      {"VariablePosition":7,"Value":"2.0.1"},
      {"VariablePosition":8,"Value":"1.2"},
      {"VariablePosition":9,"Value":26.4},
      {"VariablePosition":10,"Value":24.0}
  ]
}


Any question?

We can help you.