This tutorial will instruct you to intergrate Easy LoRaWAN Cloud into external systems.

  • To upload and retrieve sensor data
  • Via REST API or MQTT API

A. UI Server

1. REST API

REST API is used to connect Easy LoRaWAN Cloud and external systems.

Step 1.1: To retrieve tokens using username and password

  • Sample request: curl -X POST –header ‘Content-Type: application/json’ –header ‘Accept: application/json’ -d ‘{“username”:”[email protected]“, “password”:”demo-password“}’ ‘https://URL/api/auth/login’
  • Sample response: {“token”: “$YOUR_JWT_TOKEN”, “refreshToken”: “$YOUR_JWT_REFRESH_TOKEN”}
  • token” is used in API requests.
  • When “token” is expired, “refreshToken” is used to retrieve new “token”
  • When “refreshToken” is expired, to run this step again.

Step 1.2: To retrieve device id

  • On UI server, to click on a device and copy device id
  • The device id is entity id in the next step
  • OR you can get the list of devices: /api/customer/{customerId}/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}

Step 1.3: To retrieve latest sensor data

  • API: https://URL/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?keys,useStrictDataTypes}
  • Sample request: https://URL/api/plugins/telemetry/DEVICE/xxxxxx40-d7f7-11ec-924a-e16522e61bfd/values/timeseries
  • Method: GET
  • Sample JSON headers: “Accept”: “application/json”, “X-Authorization”: “Bearer  token“. The “token” is from Step 1.
  • Sample response: {“RO1_status”: [{“ts”: 1661529134507, “value”: “false”}], “RO2_status”: [{“ts”: 1661529134507, “value”: “false”}]}. “RO1_status” and “RO2_status” are the names of sensor data (e.g.: telemetries). “ts” is timestamp of updated time. “value” is the value of the data in string.

2. HTTP API

HTTP API is used for simple sensor data collection and remote control.

3. MQTT API

MQTT API is used for realtime sensor data collection and remote control.

B. UI PE Server

1. REST API

REST API is used to connect Easy LoRaWAN Cloud and external systems.

Step 1.1: To retrieve tokens using username and password

  • Sample request: curl -X POST –header ‘Content-Type: application/json’ –header ‘Accept: application/json’ -d ‘{“username”:”[email protected]“, “password”:”demo-password“}’ ‘https://URL/api/auth/login’
  • Sample response: {“token”: “$YOUR_JWT_TOKEN”, “refreshToken”: “$YOUR_JWT_REFRESH_TOKEN”}
  • token” is used in API requests.
  • When “token” is expired, “refreshToken” is used to retrieve new “token”
  • When “refreshToken” is expired, to run this step again.

Step 1.2: To retrieve device id

  • Same as in A. UI Server

Step 1.3: To retrieve latest sensor data

  • Same as in A. UI Server

2. HTTP API

HTTP API is used for simple sensor data collection and remote control.

3. MQTT API

MQTT API is used for realtime sensor data collection and remote control.

Want to explore LoRaWAN?

Subscribe Easy LoRaWAN Cloud to try all guides and visualize data from your LoRaWAN nodes.
Only 1 USD/month.