It is a JavaScript application that provides a REST API using the jooby-codec library. This application allows you to easily decode data.
git clone https://github.com/jooby-dev/jooby-rest-server.git
cd jooby-rest-server
npm ci
npm start
You can also run jooby-rest-server
using Docker. Ensure you have Docker installed on your machine, and then use the following command:
docker pull joobydev/jooby-rest-server
docker run \
--restart unless-stopped \
--network host \
--name jooby-rest-server \
joobydev/jooby-rest-server
Available environment variables:
Name | Default value | Description |
---|---|---|
NODE_ENV |
node environment setup | |
LOG_LEVEL |
info |
pino log levels |
HTTP_HOST |
0.0.0.0 |
|
HTTP_PORT |
3000 |
|
API_KEY |
if set, checks all requests with header validation for the presence of the specified value | |
CHIRPSTACK_REST_API_URL |
ChirpStack REST API url | |
CHIRPSTACK_API_KEY |
ChirpStack API KEY generated from admin panel |
Method | Path | Description |
---|---|---|
POST |
/v1/decoder |
General decoder route. Requires to specify protocol in the requests body. |
POST |
/v1/decoder/analog |
Decoder for the analog protocol based devices. |
POST |
/v1/decoder/mtx |
Decoder for the mtx protocol based devices. |
POST |
/v1/decoder/mtxLora |
Decoder for the mtxLora protocol based devices. |
POST |
/v1/decoder/obisObserver |
Decoder for the obisObserver protocol based devices. |
POST |
/v1/encoder |
General encoder route. Requires to specify protocol in the requests body. |
POST |
/v1/encoder/analog |
Encoder for the analog protocol based devices. |
POST |
/v1/encoder/mtx |
Encoder for the mtx protocol based devices. |
POST |
/v1/encoder/mtxLora |
Encoder for the mtxLora protocol based devices. |
POST |
/v1/encoder/obisObserver |
Encoder for the obisObserver protocol based devices. |
Name | Value | Description |
---|---|---|
NONE |
0 |
no framing |
HDLC |
1 |
HDLC frame format |
Default value: 0
.
Example: framingFormat: 1
.
Name | Value | Description |
---|---|---|
HEX |
1 |
data treats as hex string |
BASE64 |
2 |
data threats as base64 string |
Default value: 1
.
Example: bytesConversionFormat: 1
.
Name | Value | Description |
---|---|---|
AUTO |
0 |
auto detection |
DOWNLINK |
1 |
the path of data transmission from the device to the user |
UPLINK |
2 |
the path of data transmission from the user to the device |
Note: direction is not utilized for the obisObserver based devices.
Default value: 0
.
Example: direction: 1
.
Value | Description |
---|---|
analog |
analog protocol based devices |
mtx |
mtx protocol based devices |
mtxLora |
mtxLora protocol based devices |
obisObserver |
obisObserver protocol based devices |
Example: protocol: obisObserver
.
Valid for the mtxLora
based devices. OBIS codes used as fields in decoder reports.
Example: dlms: true
.
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 1, "bytesConversionFormat": 1,"data": "1f020048"}' \
http://localhost:3000/v1/decoder/analog
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "analog", "direction": 1, "bytesConversionFormat": 1,"data": "1f020048"}' \
http://localhost:3000/v1/decoder
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 1, "bytesConversionFormat": 2,"data": "ARAQBwAAQg=="}' \
http://localhost:3000/v1/decoder/mtx
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "mtx", "direction": 1, "bytesConversionFormat": 2,"data": "ARAQBwAAQg=="}' \
http://localhost:3000/v1/decoder
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 1, "bytesConversionFormat": 2, "data": "HgkjkSMQEAcAAADU"}' \
http://localhost:3000/v1/decoder/mtxLora
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "mtxLora", "direction": 1, "bytesConversionFormat": 2, "data": "HgkjkSMQEAcAAADU"}' \
http://localhost:3000/v1/decoder
Segment 1:
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 2, "dlms": "true", "data": "1e28c4314d1010796430280fff011d00000008001a00000008001d00000008011d00000008001a00000033"}' \
http://localhost:3000/v1/decoder/mtxLora
Segment 2:
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 2, "dlms": "true", "data": "1e28c43208001d00000008011d00000008001a00000008001d00000008011d00000008001a00000008009d"}' \
http://localhost:3000/v1/decoder/mtxLora
Segment 3:
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 2, "dlms": "true", "data": "1e21c4b31d00000008013a00000008013a00000008013a00000008013a00000008000063d0b9e5e7"}' \
http://localhost:3000/v1/decoder/mtxLora
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "data": "04050108080001"}' \
http://localhost:3000/v1/decoder/obisObserver
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "obisObserver", "data": "04050108080001"}' \
http://localhost:3000/v1/decoder
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 1, "commands": [{"id": 7}]}' \
http://localhost:3000/v1/encoder/analog
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "analog", "direction": 1, "commands": [{"id": 7}]}' \
http://localhost:3000/v1/encoder
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 1, "messageId": 2, "commands": [{"id": 7}]}' \
http://localhost:3000/v1/encoder/mtx
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "mtx", "direction": 1, "messageId": 2, "commands": [{"id": 7}]}' \
http://localhost:3000/v1/encoder
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "direction": 1, "messageId": 2, "segmentationSessionId": 2, "commands":[{"id":7}]}' \
http://localhost:3000/v1/encoder/mtxLora
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "mtxLora", "direction": 1, "messageId": 2, "segmentationSessionId": 2, "commands":[{"id":7}]}' \
http://localhost:3000/v1/encoder
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "commands":[{"requestId": 2, "id":5}]}' \
http://localhost:3000/v1/encoder/obisObserver
curl -X POST -H "Content-Type: application/json" \
-d '{"deviceEUI": "001a79881701b63c", "protocol": "obisObserver", "commands":[{"requestId": 2, "id":5}]}' \
http://localhost:3000/v1/encoder/obisObserver