Retrieve All Archived Sessions
Retrieves sessions that have completed its lifecycle.
GET /v1/sessions/history
CoAP Options
Option | Description | Value | Required |
---|---|---|---|
URI-Path | Resource segment #1 | v1 | Yes |
URI-Path | Resource segment #2 | sessions | Yes |
URI-Path | Resource segment #3 | history | Yes |
Response Parameters
Session History
All archived session objects are assumed to be cleared. Much of the properties are the same as the active session property except with an added clearType
property to define whether a session was cleared or removed.
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) |
clearType | The type of session clearing. | string (enum) values: STOP REMOVED |
label | Assigned label to a session | string | null |
state | The state of a session. | string (enum) values: started paged * cleared |
Example Response
{
"responseTypes": [
"session_history"
],
"globalSessionSequence": 116,
"timestamp": "2018-03-15T11:45:29",
"deviceName": "T7470",
"firmwareVersion": "8.4.100.43",
"session_history": [
{
"id": 11,
"uuid": "15e958b7-bc83-4dd1-b4ae-d2bc27f39b3e",
"number": 4,
"goalInSeconds": 300,
"created": "2018-03-15T08:44:13",
"started": "2018-03-15T08:44:13",
"notified": "2018-03-15T08:49:13",
"cleared": "2018-03-15T11:45:18",
"label": null,
"clearType": "STOP"
},
{
"id": 17,
"uuid": "da4b66f6-af73-45ae-8ad0-c155a306832b",
"number": 10,
"goalInSeconds": 300,
"created": "2018-03-15T08:44:35",
"started": "2018-03-15T08:44:35",
"notified": "2018-03-15T08:49:35",
"cleared": "2018-03-15T11:45:22",
"label": null,
"clearType": "REMOVED"
}
]
}
Example Code Request
// Using node-coap (yarn add coap, npm install coap): https://github.com/mcollina/node-coap
const coap = require('coap');
// Retrieving session with number 23
let req = coap.request({
host: '10.0.1.32',
port: 5683,
pathname: '/v1/sessions/history',
method: 'GET'
});
req.on('response', res => {
let json = JSON.parse(res.payload.toString('utf-8'));
if (res.code[0] === '2') { // Success
console.log(json.session_history);
} else {
// Some other error.
console.error(json);
}
});
// Send request
req.end();
Updated over 6 years ago