AdButler node.js bindings
These bindings are intended for use on the server side because they deal with secret keys explicitly. DO NOT use them in the browser.
Installation
Install using the following NPM command:
npm install --save adbutler
This will save the AdButler dependency in package.json
.
Usage
The first step is to load the library by requiring it.
var AdButler = ;
Next, create an adButler
instance.
You can pass in your secret API key in the configuration object as shown below.
var adButler = 'apiKey': 'YOUR_API_KEY'
Every resource can be accessed via the adButler
instance and supports create
,
read
, update
, delete
, and list
operations.
The library supports callback based and promise based usage.
Pick the programming style you like.
A brief overview of both follows.
Callback based usage
Every resource method accepts a callback function as the last argument.
Following Node.js convention, the error object is
always passed as the first argument to the callback function, and is null
if
no error occurred.
Here is a simple example.
adButleradvertisers;
Promise based usage
Every resource method returns a promise if no callback function is given.
// Create a new media groupadButlermediaGroups;
Configuration
adButler.set('apiKey', 'your_SECRET_api_key ');
adButler.set('timeout', 20000); // in ms
(default is node's default:120000ms
)
Documentation
See our detailed API documentation.
Development
Run the tests using npm
:
$ npm install$ npm test
If you wish, you may run tests using your AdButler Test API key by setting
the environment variable ADBUTLER_TEST_API_KEY
before running tests:
$ export ADBUTLER_TEST_API_KEY='your_api_key'$ npm test
Note: On Windows use SET
instead of export
for setting the
ADBUTLER_TEST_API_KEY
environment variable.
License
© 2016–2017 SparkLIT. Released under the MIT license.