cloudagents-node
A node.js client library for the Securibox Cloud Agents API
Install
$ npm install cloudagents
Getting started
The module supports all Cloud Agents API endpoints. For complete information about the API, head to the online documentation.
Endpoints
All endpoints require a valid authentication strategy provided by the Securibox team to access (basic or bearer/JWT).
var CloudAgents = ; var client = cloudagents_env;var authStrategy = api_username api_password;//or authStrategy = new CloudAgents.BearerStrategy("[token]");client;
Once an instance of the client has been created you use the following methods:
var CloudAgents = ; // Initialize clientvar client = cloudagents_env; // Initialize authentication strategyvar authStrategy = api_username api_password; // Bind authentication strategy to clientclient; //list all categoriesclient; //list all agentsclient;//list agents by categoryclient;//search agentsclient; //list all accountsclient;//list accounts by agentclient;//create accountclient;//modify accountclient;//delete accountclient;//synchronize accountclient;//search accountclient; //search synchronizationsclient//get all syncrhonization for an accountclient;//get all syncrhonization for an accountclient;//acknowledge synchronization by accountclient; //search documents by account, user, pending with or without contentclient;//get a specific downloaded documentclient;//acknowledge the reception of a specific documentclient;//get documents by account idclient;
All parameters except options are required. If the options parameter is omitted, the last argument to the function will be interpreted as the callback.
Callbacks
All callbacks are in the form:
{ // err can be a network error or a Securibox API error.}
Examples
Collect invoices from DropBox:
var CloudAgents = ; var environment = "https://sca-multitenant-prod.securibox.eu/api/v1/"; // Initialize clientvar client = environment;var basicAuthentication = 'api_username' 'api_password';client; //Account to createvar account = customerAccountId: 'randomDropboxAccountID' customerUserId: 'UserABCD' name: 'John DropBox account' agentId: '5194a49d6d064d708ed004bc12709241' //Dropbox ID that you can get by listing all available agents credentials: position: 0 value: "mydropboxusername@test.com" alg: null position: 1 value: "mydropboxpassword" alg: null //Create account and launch synchronizationclient; // Pool synchronization status to until we get a final statusvar interval = ;
Tests
$ make test