Settings API
Controlling the settings of the transmitter.
The settings provide a list of options that are configurable within the transmitter. Some of these settings are not yet exposed.
CoAP Options
Option | Description | Value | Required |
---|---|---|---|
URI-Path | Resource segment #1 | v1 | Yes |
URI-Path | Resource segment #2 | settings | Yes |
Setting Properties
Property | Description | Type |
---|---|---|
datetime | Current date and time of the transmitter. | String (ISO8601) |
systemId | Identifier that pagers should match in order to be paged. | Number |
defaultTargetGoal | The default target goal for sessions to use if goal is omitted when creating session. | Number |
statisticsClearMark | Hour of a day to clear statistics. | Number (0-24) |
GET /v1/settings
Retrieves the current settings.
Response Example
{
"responseTypes":[
"settings"
],
"globalSessionSequence":120,
"timestamp":"2018-03-15T14:02:15",
"deviceName":"T7470",
"firmwareVersion":"8.4.100.43",
"settings":{
"datetime":"2018-03-15T14:02:15",
"systemId":0,
"defaultTargetGoal":300,
"statisticsClearMark":24
}
}
Example Code
// Using node-coap (yarn add coap, npm install coap): https://github.com/mcollina/node-coap
const coap = require('coap');
let req = coap.request({
host: '10.0.1.32',
port: 5683,
pathname: '/v1/settings',
method: 'GET'
});
req.on('response', res => {
let json = JSON.parse(res.payload.toString('utf-8'));
if (res.code[0] === '2') { // Success
// Settings
console.log(json.settings);
} else {
console.error(json);
}
});
// Send request
req.end();
POST /v1/settings
Any of the settings properties above can be used in the request body.
Request Example
Keep request body compact!
When testing the API, ensure your JSON is compact and no tabs or newlines are submitted.
{ "datetime": "2018-03-15T12:35:33", "systemId": 5 }
Response Example
{
"responseTypes":[
"settings"
],
"globalSessionSequence":120,
"timestamp":"2018-03-15T12:35:33",
"deviceName":"T7470",
"firmwareVersion":"8.4.100.43",
"settings":{
"datetime":"2018-03-15T14:02:15",
"systemId":5,
"defaultTargetGoal":300,
"statisticsClearMark":24
}
}
Example Code Request
// Using node-coap (yarn add coap, npm install coap): https://github.com/mcollina/node-coap
const coap = require('coap');
// Using moment to retrieve system date and time.
const moment = require('moment');
let req = coap.request({
host: '10.0.1.32',
port: 5683,
pathname: '/v1/settings',
method: 'POST',
options: {
'Content-Format': 'application/json'
}
});
req.on('response', res => {
let json = JSON.parse(res.payload.toString('utf-8'));
if (res.code[0] === '2') { // Success
console.log(json.settings);
} else {
console.error(json);
}
});
// Set date and time of transmitter according to integrator system,
// Set default system ID to 23
req.write(JSON.stringify({
datetime: moment().local().format(),
systemId: 23
});
// Send request
req.end();
Updated over 6 years ago