HTTP communication module "http"
Description
The HTTP module makes it possible to send measurement data as HTTP(S) requests.
Interfaces & protocols used
- Network communication via HTTP(S)
JSON configuration
The following section describes the entire JSON configuration of the module and explains the individual parameters.
Example configuration (typical configuration)
{
"module": "HTTP",
"factory": "http",
"config":{
"enabled":true,
"pollingIntervalMs":10000,
"traceMode": "startup,failure,ssl",
"traceFileCount":10,
"traceFileSize":524288,
"traceLength":10,
"requests":[
{
"url":"https://127.0.0.1:12345/hello/world",
"insecure":true,
"verbose":false,
"headerExtensions":[
{
"key": "Authorization",
"value":"Basic bG9rb21vdGl2ZQ=="
}
],
"channels":[
"someFloatChannel",
"someGpsLocationChannel",
"someStringChannel"
]
}
]
}
}
Global module parameters
Parameter name | Required | Data type | Sensible value range | Default value | Description |
---|---|---|---|---|---|
enabled | No | BOOL | true, false | true | to disable data transmission |
pollingIntervalMs | No | INT | 10000 (10 s) - | 60000 (60 s) | polling interval [ms] |
traceMode | No | STRING | "" | String, which can contain "startup", "failure" and "ssl". A trace is written accordingly after the measurement mode is started up or if the HTTP transmission fails. Optionally incl. SSL handshake recording, if configured. | |
traceFileCount | No | INT | 1 - 20 | 10 | Maximum number of trace files (one per HTTP request) |
traceFileSize | No | INT | 524288 - 20971520 (512 kB - 20 MB) | 524288 (512 kB) | Maximum size of trace files |
traceLength | No | INT | 1 - 20 | 10 | Maximum number of competing trace files (rotating) |
requests | YES | JSON Array of JSON Object | HTTP(S) requests (see below) |
Configuration of the HTTP(S) requests
An HTTP(S) request is configured in the form of a JSON object, which can contain the following parameters
parameter name | required | data type | meaningful value range | default value | description |
---|---|---|---|---|---|
url | YES | STRING | URL of the HTTP(S) request (incl. protocol specification http:// or https:// and directory path specification) | ||
insecure | No | BOOL | false, true | false | to deactivate HTTPS server verification |
verbose | No | BOOL | false, true | false | to enable verbose logging |
headerExtensions | No | JSON Array of JSON Object | [] | for adding a list of HTTP header attributes in the form of key value pairs of arbitrary strings (see configuration example) | |
channels | YES | JSON Array of STRING | valid channel names | list of channels to be transmitted |
Format (example) of the transmitted HTTP requests
Note: The content of the request is transferred in COMPACT JSON notation, i.e. without additional white space
POST /hello/world HTTP/1.1
Host: 127.0.0.1:12345
Accept: */*
Authorization: Basic bG9rb21vdGl2ZQ==
Content-Type: application/json
Content-Length: 917
{
"time":"1970-01-01T00:00:00.000Z",
"data":[
{
"k": "someFloatChannel",
"v":1.234000e+01
},
{
"k": "someGpsLocationChannel",
"v":{
"lat":50.0000000,
"lon":8.0000000,
"alt":123.0
}
},
{
"k": "someStringChannel",
"v": "Hello, World!"
}
]
}
Module information
Information | Value |
---|---|
Authors | optiMEAS Measurement and Automation Systems GmbH |
since smartCORE | 2.5 |
Module type | Consumer |
Dependencies | NONE |