Nibbling Perfect Macaroni
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

zoho

1.0.0 • Public • Published

zoho-node

Node.js Zoho helper library for integrating Zoho Creator, CRM, Invoice and Support.

npm version Build Status Join the chat at https://gitter.im/4yopping/zoho Inline docs Dependencies

Installation

$ npm install zoho

Features

  • Zoho Creator
  • Zoho CRM
  • Zoho Invoice
  • Zoho Support

API

Zoho

Initialize zoho

var Zoho = require('zoho');

Zoho#CRM(object)

Initialize CRM with an object authtoken

var crm = new Zoho.CRM({
  authtoken: 'bad18eba1ff45jk7858b8ae88a77fa30'
});
getRecords(<string> type, <function> callback):
crm.getRecords('leads', function (err, data) {
  if (err) {
    return console.log(err);
  }
 
  console.log(data);
});

Zoho#Invoice(object)

Initialize Invoice with an object authtoken

var invoice = new Zoho.Invoice({
  authtoken: 'bad18eba1ff45jk7858b8ae88a77fa30'
});
getRecords(<string> type, <function> callback):
invoice.getRecords('contacts', function (err, data) {
  if (err) {
    return console.log(err);
  }
 
  console.log(data);
});

Zoho#Support(object)

Initialize Support with an object authtoken

var support = new Zoho.Support({
  authtoken: 'bad18eba1ff45jk7858b8ae88a77fa30'
});
getRecords(<string> type, <function> callback):
support.getRecords('contacts', function (err, data) {
  if (err) {
    return console.log(err);
  }
 
  console.log(data);
});

Zoho#Creator(object)

Initialize Creator with an object authtoken

var creator = new Zoho.Creator({
  authtoken: 'bad18eba1ff45jk7858b8ae88a77fa30'
});
setCookie(<string> cookie)

Set a cookie for "unofficial" API calls that require direct HTTP schemes.

creator.setCookie('somecookie');
viewRecordsInView(<string> applicationLinkName, <string> viewLinkName, <function> callback):
creator.viewRecordsInView('sample','Employee_View', function (err, data) {
  if (err) {
    return console.log(err);
  }
 
  console.log(data);
});
addRecords(<string> applicationLinkName, <string> formLinkName, <object> params, <function> callback)

Add records.

See https://www.zoho.com/creator/help/api/rest-api/rest-api-add-records.html

 
editRecords(<string> applicationLinkName, <string> formLinkName, <object> params, <function> callback)

Edit records.

See https://www.zoho.com/creator/help/api/rest-api/rest-api-edit-records.html

 
deleteRecords(<string> applicationLinkName, <string> formLinkName, <object> params, <function> callback)

Delete records.

See https://www.zoho.com/creator/help/api/rest-api/rest-api-delete-records.html

 
viewRecordsInView(<string> applicationLinkName, <string> formLinkName, <object> params, <function> callback)

Get records in view.

See https://www.zoho.com/creator/help/api/rest-api/rest-api-view-records-in-view.html

 
listFormFields(<string> applicationLinkName, <string> formLinkName, <object> params, <function> callback)

List form fields.

See https://www.zoho.com/creator/help/api/rest-api/rest-api-list-form-fields.html

 
downloadImage(<string> endpoint, <object> params, <function> callback)

Progmatically downloads a single image from Zoho Creator. Zoho doesn't officially provide support for downloading images or assets. However, this function will interact directly with the download endpoint. This requires a valid cookie to be set prior to requests.

 
creator.setCookie('somecookie');
 
creator.downloadImage('/DownloadFile.do', {
  filepath: '/somefilename.JPG',
  sharedBy: '',
  appLinkName: '',
  viewLinkName: '',
  recLinkID: '',
  fieldLinkName: 'Image',
  zcDownloadType: 'image'
}, function (err, data) {
  if (err) { return res.send(err); }
 
  res.send(new Buffer(data));
 
});

Reference

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

In order to colaborate to this project, create a .testrc file with the contents below to run unit tests:

{
  "crm": {
    "authtoken": "..."
  },
  "invoice": {
    "authtoken": "..."
  },
  "support": {
    "authtoken": "..."
  }
}

License

MIT

Keywords

install

npm i zoho

Downloadsweekly downloads

1,591

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability