Retrieving All Active Sessions
Retrieves active sessions that have not completed its lifecyle (i.e. removed or cleared)
GET /v1/sessions
CoAP Options
Option | Description | Value | Required |
---|---|---|---|
URI-Path | Resource segment #1 | v1 | Yes |
URI-Path | Resource segment #2 | sessions | Yes |
ETag | Time-based value provided by response for caching. If provided, transmitter will check if anything has changed and either send a blank 2.03 response where cache response is valid or new response to update cache along with new ETag value to record. | No |
Response Properties
Statistics
Statistics are bundled in with session responses to help keep updated about the calculated results of all the sessions.
Property | Description | Type |
---|---|---|
guestsServed | Number of guests served or otherwise known as paged. | number |
percentLate | Percentage of guests that were paged after the target goal. | number |
percentOnTime | Percentage of guests that were paged within the target goal. | number |
averageTimeServed | Time in seconds of the average elapsed time before sessions were paged. | number |
numSessions | Total number of sessions that were created. | number |
Sessions
This will include an array of session objects that are active.
Property | Description | Type |
---|---|---|
id | Unique sequential number for each session that is created. | number |
uuid | UUID v4 that is generated for each session. | number |
number | Pager number the session is bound to. | number |
partySize | The size of the party for a session. | number |
goalInSeconds | The target goal in seconds that was assigned to the session. | number |
created | Timestamp of when the session is created. | string (ISO8601) |
started | Timestamp of when the session is started. Will be the same as started | string (ISO8601) |
notified | Timestamp when the session is paged. | string (ISO8601) |
cleared | Timestamp when the session is cleared. (Will only appear for notifications) | string (ISO8601) |
label | Assigned label to a session | string | null |
state | The state of a session. | string (enum) values: started paged * cleared |
Example Response
{
"responseTypes": [
"sessions",
"statistics"
],
"globalSessionSequence": 111,
"timestamp": "2018-03-15T10:48:26",
"deviceName": "T7470",
"firmwareVersion": "8.4.100.43",
"statistics": {
"guestsServed": 40,
"percentLate": 0,
"percentOnTime": 100,
"averageTimeServed": 285,
"numSessions": 40
},
"sessions": [
{
"id": 11,
"uuid": "15e958b7-bc83-4dd1-b4ae-d2bc27f39b3e",
"number": 4,
"partySize": 1,
"goalInSeconds": 300,
"created": "2018-03-15T08:44:13",
"started": "2018-03-15T08:44:13",
"notified": "2018-03-15T08:49:13",
"label": null,
"state": "paged"
},
{
"id": 12,
"uuid": "46f21845-7e9a-4ab2-a72b-78caaa4e9f40",
"number": 5,
"partySize": 1,
"goalInSeconds": 300,
"created": "2018-03-15T08:44:15",
"started": "2018-03-15T08:44:15",
"notified": "2018-03-15T08:49:15",
"label": null,
"state": "paged"
}
]
}
Example Code Request
// 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/sessions',
method: 'GET'
});
req.on('response', res => {
let json = JSON.parse(res.payload.toString('utf-8'));
if (res.code[0] === '2') { // Success
// Array of sessions
console.log(json.sessions);
} else {
console.error(json);
}
});
// Send request
req.end();
Updated over 6 years ago