To send downlinks via API you can use external applications like Postman or cURL
Requirements:
- API URL
- https://[server_name]/1/rest (e.g. https://eu3.loriot.io/1/rest)
- Authentication: Bearer prefix + APPLICATION ACCESS TOKEN.
- Body: see examples
The token can be found in the users application in the LORIOT dashboard.
Below you can find some examples:
cURL
curl --location --request POST 'https://eu1.loriot.io/1/rest' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer vgEADQAAAA9iY2dkdi5sb3Jpb3QuaW-ve6WTseo19IasKoGVQJSn' \
--header 'Content-Type: text/plain' \
--data-raw '{
"cmd": "tx",
"EUI": "BE7A000000000009",
"port": 33,
"confirmed": false,
"data": "0ffff0",
"appid": "BE01000D"
}'
Entries in red should be updated with users data.
Postman
import requests headers = { 'Content-Type': 'text/plain', 'Authorization': 'Bearer vgEADQAAAA9iY2dkdi5sb3Jpb3QuaW-ve6WTseo19HasKoGVQJS1', } data = '{ "cmd": "tx", "EUI": "BE7A000000000009", "port": 33, "confirmed": false, "data": "0ffff0", "appid": "BE01000D" }' response = requests.post('https://eu1.loriot.io/1/rest', headers=headers, data=data)
PHP
<?php $request = new HttpRequest(); $request->setUrl('https://eu1.loriot.io/1/rest'); $request->setMethod(HTTP_METH_POST); $request->setHeaders(array( 'Authorization' => 'Bearer vngP0gAAAA1ldTEubG9yaW90Lmlvbwvpo9vGjp9iwWFRtybpKA==', 'Content-Type' => 'application/json' )); $request->setBody('{ "cmd": "tx", "EUI": "0004A30B001AF421", "port": 33, "confirmed": false, "data": "0ffff0", "appid": "BE010037" }'); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }