Hello,
In the CE 9.13 Application Programming Interface (API) Reference Guide the xapi commands list was updated with the "xCommand Bookings Put" command to push meetings to the endpoint:

using this JSON format, we are trying to implement this command in a macro so that the terminal is able to push himself a booking(s) list:
const xapi = require('xapi');
//when the jsxapi connection is ready...
xapi.on('ready', () => {
console.log('connection successful');
pushBookingsList(console.log);
});
// Push the bookings list
function pushBookingsList(cb) {
// JSON Bookings Data to be sent
var payload = {
Bookings: [
{
Id: "1",
Number: "123456789@my.domain",
Organizer: {
Name: "Organizer Name"
},
Protocol: "SIP",
Time: {
Duration: 60,
EndTimeBuffer: 50,
StartTime: "2020-09-10T14:00Z"
},
Title: "Push OBTP through Macro"
}
]
};
xapi.command(
'Bookings Put',{}, JSON.stringify(payload))
.then((response) => {
if ((response.StatusCode == 200) || (response.StatusCode == 201)) {
console.log("Booking(s) Pushed Successfully to endpoint.")
if (cb) cb(null, response.StatusCode)
return
}
console.log("Booking(s) Push failed with status code: " + response.StatusCode)
if (cb) cb("Booking(s) Push with status code: " + response.StatusCode, response.StatusCode)
})
.catch((err) => {
console.log("Booking(s) Push failed with err: " + err.message)
if (cb) cb("Could not Push the Booking(s) list to the endpoint.")
})
}
However it does not work, we are getting a "Device not entitled" error when sending the command.
This feature is poorly documented and the error does not appear in any Cisco official document: would you have some additional information about this command and what is wrong in our code?
As a side note, the "xCommand Bookings List" works great:
const xapi = require('xapi');
//when the jsxapi connection is ready...
xapi.on('ready', () => {
console.log('connection successful');
getBookingsList();
});
// Get the bookings list
function getBookingsList() {
try {
var result = xapi.command('Bookings List', { Days: 10, Limit: 100 })
// JSON Formatted Bookings Data
.then((bookingsList) => { console.log(bookingsList)});
}
catch(err) {
console.error(`cannot get bookings list.`);
throw new Error("BOOKINGS_LIST_ERROR");
}
}
Thanks for your help!