Updating/Clearing/Removing a Session

Updates a session.

PUT /v1/sessions?number=

Updates a session.

CoAP Options

OptionDescriptionValueRequired
URI-PathResource segment #1v1Yes
URI-PathResource segment #2sessionsYes
URI-QueryQuery optionnumberYes

Request Properties

PropertyDescriptionTypeRequired
goalDesired target goal in seconds.numberNo
labelLabel to assign to sessionstringNo
partySizeSize of party for sessionnumberNo
actionAction to perform on session. (i.e. page, clear, remove)string (enum)
values:
page
clear
* remove
No

Example Request

🚧

Keep request body compact!

When testing the API, ensure your JSON is compact and no tabs or newlines are submitted.

{ "action": "page", "pageMode": "Flash30Sec" }

Response Properties

Statistics

Statistics are bundled in with session responses to help keep updated about the calculated results of all the sessions.

PropertyDescriptionType
guestsServedNumber of guests served or otherwise known as paged.number
percentLatePercentage of guests that were paged after the target goal.number
percentOnTimePercentage of guests that were paged within the target goal.number
averageTimeServedTime in seconds of the average elapsed time before sessions were paged.number
numSessionsTotal number of sessions that were created.number

Sessions

To keep consistent with retrieval, a single session will be included in an array.

PropertyDescriptionType
idUnique sequential number for each session that is created.number
uuidUUID v4 that is generated for each session.number
numberPager number the session is bound to.number
partySizeThe size of the party for a session.number
goalInSecondsThe target goal in seconds that was assigned to the session.number
createdTimestamp of when the session is created.string (ISO8601)
startedTimestamp of when the session is started. Will be the same as startedstring (ISO8601)
notifiedTimestamp when the session is paged.string (ISO8601)
clearedTimestamp when the session is cleared. (Will only appear for notifications)string (ISO8601)
labelAssigned label to a sessionstring | null
stateThe state of a session.string (enum)
values:
started
paged
* cleared

Example Response

{
   "responseTypes":[
      "sessions",
      "statistics"
   ],
   "globalSessionSequence":117,
   "statistics":{
      "guestsServed":40,
      "percentLate":0,
      "percentOnTime":100,
      "averageTimeServed":285,
      "numSessions":41
   },
   "sessions":[
      {
         "id":48,
         "sessionSequence":117,
         "uuid":"947fbd21-3025-45e0-922a-db28a6eab95d",
         "number":66,
         "partySize":4,
         "goalInSeconds":60,
         "created":"2018-03-15T11:55:20",
         "started":"2018-03-15T11:55:20",
         "label":"Sarah",
         "state":"started"
      }
   ]
}

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',
  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
    // Session paged
    console.log(json.sessions[0]);
  } else {
    // Some other error.
    console.error(json);
  }
});

// Paging a session
req.write(JSON.stringify({
  number: 66,
  action: 'page'
}));

// Clearing a session
/************
req.write(JSON.stringify({
  number: 66,
  action: 'clear'
}));
************/


// Removing a session
/************
req.write(JSON.stringify({
  number: 66,
  action: 'remove'
}));
************/

// Send request
req.end();