The CallFire API provides a robust interface to control functionality available through the regular web interface, plus some controls which are not otherwise accessible.
This library provides a set of node.js classes to interface with the CallFire API. Please refer to the API documentation for information on finding your API credentials.
The REST API will be the primary API endpoint in our example documentation, because its design aims to make the structure of API requests more intuitive and stable.
This example demonstrates how to instantiate the REST API client, create a request object, invoke a request, and then parse the response into an easily-consumable form.
var callfire = require('callfire');
(function() {
'use strict';
var broadcast = new callfire("<api-username>", "<api-password>", "Broadcast");
broadcast.QueryBroadcasts({
MaxResults: 10
}, function(response) {
var result = broadcast.response(response),
i = 0;
console.log('There are ' + result.totalResults + ' total broadcasts.');
console.log('Here are the ones returned:');
for(i = 0; i < result.resources.length; i++) {
console.log(result.resources[i]);
}
});
}) ();All client methods for doing API calls accept a callback function which is passed the raw response body from the API upon success.
Each client has a ::response method which can be used to parse the raw response
data into one of the Response types (e.g. ResourceList).