BatchBook CRM API Wrapper
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
test
README.md
index.js
package.json

README.md

NOT MAINTAINED

BatchBook CRM API Wrapper (for node)

read more about the batchbook-api

Usage

Using batchbook is easy, create a client, start doing things.

var batchbook = require('batchbook');

var client = batchbook.createClient({
  key: 'api_key',
  account: 'account_name'
});

GET

Get a list of documents, batchbook has a 30 document maximum github/batchbook

// to stream...
client.get('people', {tags: 'awesome'}).once('data', function(res) {
  console.log(res);
});

// ...or not to stream
client.getSync('people', {email: 'someguy@somebusiness.com'}, function(err, resp, body) {
  console.log(body);
});

Getting a single document

client.get('people', 39).once('data', function(res) {
  console.log(res);
});

POST

Create a document on batchbook, it'll return the created document along with it's batchbook id :)

// to stream...
client.post('people', {first_name: 'Steve', last_name: 'Henderson'}).once('data', function(res) {
  console.log(res);
});

// ..or not to stream
client.postSync('people', {first_name: 'Steve', last_name: 'Henderson'}, function(err, res, body) {
  console.log(res.statusCode);
  console.log(body);
});

PUT

Update a document on batchbook, make sure you also pass in the document's id!

// to stream...
client.put('people', {id: 39, first_name: 'Andy'}).once('response', function(res) {
  console.log(res.statusCode);
});

// ...or not to stream
client.putSync('people', {id: 39, first_name: 'Andy'}, function(err, res, body) {
  console.log(res.statusCode);
});

DELETE

// to stream...
client.delete('people', 39).once('response', function(res) {
  console.log(res.statusCode);
});

// ...or not to stream
client.deleteSync('people', 39, function(err, res, body) {
  console.log(res.statusCode);
});

TODO's

  • Finish writing tests for requests
  • XML style post, put, deletes (don't know if this will ever get done)