DaaS (Decoder as a Service)

Run public code snippets from your Plugin or UbiFunction

- This feature is in beta -

The LoRaWAN ecosystem continues to grow, and so does the length of the decoders needed to transform a binary or base64 payloads, into friendly JSON ones.

Copy-pasting such decoders can get confusing for two reasones:

  • Some of them have hundreds of lines of code - and continue to grow as more sensors and features are added to the devices.

  • Most -if not all- LoRaWAN vendors offer their decoders in NodeJS, making them uncompatible if you're developing your functions in Python.

Because of this, we created a public DaaS (Decoder as a Service) endpoint:

To make use of it, make a POST request to the following:

URL

HTTP MethodURL

POST

https://functions.ubidots.com/pub/decode/custom

Headers

HeaderValue

Content-Type

application/json

x-auth-token

<your-ubidots-token>

Body

ParameterDescriptionExample

url

The public URL containing the code you wish to execute. Expects a raw text. When using Github, please set the URL to raw text mode.

"https://raw.githubusercontent.com/Seeed-Solution/TTN-Payload-Decoder/master/decoder_new-v3.js"

payload

JSON payload, containing the arguments expected by the public URL

{

"fPort": 1, "bytes":"SGVsbG8sIHdvcmxkIQ="

}

function

The internal function inside the public URL code, that you wish to target with the given payload

"decodeUplink"

Example

POST https://functions.ubidots.com/pub/decode/custom

"Content-Type": "application/json"
"x-auth-token": "BBFF-123456789"

{
    "url": "https://raw.githubusercontent.com/Seeed-Solution/TTN-Payload-Decoder/master/decoder_new-v3.js",
    "payload": {
        "fPort": 1, 
        "bytes": "SGVsbG8sIHdvcmxkIQ="
     }, 
     "function": "decodeUplink"
}

Last updated