Table of Contents

Remote HTTP

Introduction

A HTTP client is running on the gateway. It can be used to forward end-devices Rx data to HTTP server in real-time (Rx data are forwarded as soon as they are received).

Its configuration is available in Configuration ⇒ Interfaces ⇒ Remote HTTP menu.

Remote HTTP

It is possible to configure:

rx_data suffix is no more added automatically in URL since SPN version 2.1. You must add it in path if used in your HTTP server configuration.

All data transmitted between client and server are encoded in JSON format.

If transmission fails, frames not sent are stored to be sent later on. The 10000 most recent frames are saved in RAM, the other ones are discarded. Frames are deleted from the RAM once successfully transmitted.

The examples featured in this guide use the program ncat to simulate an HTTP server.
For testing purposes, you could also use mockable.io.

Receive data

The gateway will send a POST requests when it receives frames from an end-device. The body of this request will contain the data of the received frames as a JSON string.

The HTTP headers indicate:

The HTTP body contains an rx_data JSON object.

Rx packets structure

Here is the structure of an RX packet sent over HTTP:

Example

Here is an example of one RX packet sent by the Wanesy SPN gateway.ncat, awk and jq are used to illustrate this example:

ncat -lp 12345 | awk '/^\r$/ { body=NR } body && NR > body { print $0 }' | jq -r .

Output:

$ ncat -lp 8000 | awk '/^\r$/ { body=NR } body && NR > body { print $0 }' | jq -r .
{
  "rx_data": {
    "rxdata_id": 77,
    "end_device_id": "0018B20000000BAA",
    "received_time": 1510669226,
    "sequence_number": 1,
    "port": 1,
    "radio_id": 0,
    "channel": 1,
    "rssi_dbm": -45,
    "snr_db": 9.2,
    "frequency_hz": 868300000,
    "modulation_type": "LORA",
    "data_rate": "SF12BW125",
    "coding_rate": "4/5",
    "adr": 1,
    "payload": "nhxICQcQABNRUSYAAA53"
  }
}

Help

Inline help is available in web user interface in Configuration ⇒ Interfaces ⇒ Remote HTTP ⇒ Help

An extract of this help is available below:

Click to display ⇲

Click to hide ⇱

Click to hide ⇱

Common parameters

This service is used to push Rx data to a HTTP server via REST API.

The common URI is:

http(s)://path.to.host:port/path
  • path.to.host: host name or IP address.
  • port: server port.
  • path: path, starts with /.

Flow syntax

Rx data flow

Rx data are pushed to:

http(s)://path.to.host:port/path