Skip to main content

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 nameRequiredData typeSensible value rangeDefault valueDescription
enabledNoBOOLtrue, falsetrueto disable data transmission
pollingIntervalMsNoINT10000 (10 s) -60000 (60 s)polling interval [ms]
traceModeNoSTRING""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.
traceFileCountNoINT1 - 2010Maximum number of trace files (one per HTTP request)
traceFileSizeNoINT524288 - 20971520 (512 kB - 20 MB)524288 (512 kB)Maximum size of trace files
traceLengthNoINT1 - 2010Maximum number of competing trace files (rotating)
requestsYESJSON Array of JSON ObjectHTTP(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 namerequireddata typemeaningful value rangedefault valuedescription
urlYESSTRINGURL of the HTTP(S) request (incl. protocol specification http:// or https:// and directory path specification)
insecureNoBOOLfalse, truefalseto deactivate HTTPS server verification
verboseNoBOOLfalse, truefalseto enable verbose logging
headerExtensionsNoJSON 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)
channelsYESJSON Array of STRINGvalid channel nameslist 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

InformationValue
AuthorsoptiMEAS Measurement and Automation Systems GmbH
since smartCORE2.5
Module typeConsumer
DependenciesNONE