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

LoRaWAN Server

1. REST API

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

lorawan restapi

Step 1: To create an API Key in LoRaWAN server

lorawan apikey

Step 2: To execute the REST API with API Key.

curl --request POST \
  --url https://lorawan.easylorawan.com/api/devices/xxxxxxfffe11c893/queue \
  --header 'Authorization: Bearer API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "queueItem": {
    "confirmed": false,
    "data": "ABCD",
    "fPort": 1,
    "isEncrypted": false,
    "isPending": false
  }
}'

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.

UIPE 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.

5 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Want to test LoRaWAN?

Subscribe Easy LoRaWAN Cloud to try this guide on your LoRaWAN gateways and nodes.
We will help you to get started and troubleshooting.

Thanks for the guides?

If this guide saves your days, you can give us a cup of coffee.
This is one-time donation.
Thank you for supporting us.