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
1. REST API
REST API is used to connect Easy LoRaWAN Cloud and external systems.
- URL: ui.easylorawan.com
- API Docs: https://ui.easylorawan.com/swagger-ui/
- Tool to test REST API: https://insomnia.rest/download
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.
- Server: https://ui.easylorawan.com
- Documentation: https://thingsboard.io/docs/reference/http-api
3. MQTT API
MQTT API is used for realtime sensor data collection and remote control.
- MQTT Server: uiserver.easylorawan.com
- Port: 1883
- Documentation: https://thingsboard.io/docs/reference/mqtt-api
1. REST API
REST API is used to connect Easy LoRaWAN Cloud and external systems.
- URL: uipe.easylorawan.com
- API Docs: https://uipe.easylorawan.com/swagger-ui/
- Tool to test REST API: https://insomnia.rest/download
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.
- Server: https://uipe.easylorawan.com
- Documentation: https://thingsboard.io/docs/pe/reference/http-api
3. MQTT API
MQTT API is used for realtime sensor data collection and remote control.
- MQTT Server: uipeserver.easylorawan.com
- Port: 1883
- Documentation: https://thingsboard.io/docs/pe/reference/mqtt-api
Want to explore LoRaWAN?
Subscribe Easy LoRaWAN Cloud to try all guides and visualize data from your LoRaWAN nodes.
Only 1 USD/month.