REST Adapter

This adapter helps to set values or get values using only POST/GET requests.

Authorization

You may add Basic Auth fill the inputs or leave empty for No Auth.

Allowed topics

Allowed MQTT topics to set or get values. All topics are set by default # Also supports two different kinds of wildcards: single-level and multi-level.

The addon settings

Bridge launch

After starting the bridge a new string will be added with Service ID, this ID is used to get/set values in Postman.

The addon settings

Variables

<base-url> host where run 2Smart Standalone project. For example <base-url> in Variables Postman :

<base_url>/service/oqd4fqhf8nixx4mdss44

Topics

Get topics

GET <base-url>/api/v1/topics?to=<topic or topic object or array of either>
  • to is topic
  • to is topic objects with wildcards(+, #)
  • to is array of topics and topic objects

Examples

GET <base-url>/api/v1/topics?to=a/b/c
GET <base-url>/api/v1/topics?to=a/+/c
GET <base-url>/api/v1/topics?to=a/+/#
GET <base-url>/api/v1/topics?to[]=a/b/c&to[]=a/+/c&to[]=a/+/#

Response samples

   {
        "status": 1,
        "data": {
          "topics": {
            "topic1":"<topic1-value>",
            "topic2":"<topic2-value>",
            // ...
          }
        }
    }

Postman window

Set topics

POST <base-url>/api/v1/topics/set

Body

{ topics:{ "topic1":, "topic2": } }

Response samples

   {
        "status": 1,
        "data": {
          "topics": {
            "topic1":"<topic1-value>",
            "topic2":"<topic2-value>",
            // ...
          },
          "topicErrors": {
            "topic1":{
              "code":"<ERROR_CODE>" 
            },
            // ...
          }
        }
    }

Postman window

Entities

Get devices

GET <base-url>/api/v1/devices?only_ids=<true|false>
  • only_ids=true to return only device ids
  • only_ids=false to return device objects

Response samples (only_ids=true)

   {
        "status": 1,
        "data": {
          "devices": [
            "<device1-id>",
            "<device2-id>",
            // ...
          ]
        }
    }

Response samples (only_ids=false)

   {
        "status": 1,
        "data": {
          "devices": [
            {/* device1 object */},
            {/* device2 object */},
            // ...
          ]
        }
    }

Postman window

Get device by id

GET <base-url>/api/v1/device?deviceId=<device-id>

Response samples

   {
        "status": 1,
        "data": {
          "device": {
            /* device object */
          }
        }
    }

Postman window

Get node by id

GET <base-url>/api/v1/node?deviceId=<device-id>&nodeId=<node-id>

Response samples

   {
        "status": 1,
        "data": {
          "node": {
            /* node object */
          }
        }
    }

Postman window

Get sensor by id

GET <base-url>/api/v1/sensor?deviceId=<device-id>&nodeId=<node-id>&sensorId=<sensor-id>

Response samples

   {
        "status": 1,
        "data": {
          "sensor": {
            /* sensor object */
          }
        }
    }

Postman window

Get option by id (of device or node)

GET <base-url>/api/v1/option?deviceId=<device-id>&optionId=<option-id>
GET <base-url>/api/v1/option?deviceId=<device-id>&nodeId=<node-id>&optionId=<option-id>

Response samples

   {
        "status": 1,
        "data": {
          "option": {
            /* option object */
          }
        }
    }

Postman window

Get telemetry by id(of device or node)

GET <base-url>/api/v1/telemetry?deviceId=<device-id>&telemetryId=<telemetry-id>
GET <base-url>/api/v1/telemetry?deviceId=<device-id>&nodeId=<node-id>&telemetryId=<telemetry-id>

Response

   {
        "status": 1,
        "data": {
          "telemetry": {
            /* telemetry object */
          }
        }
    }

Postman window

results matching ""

    No results matching ""