Git Product home page Git Product logo

js-sugar's Introduction

js-sugar

Node.js connector for Sugar CRM version 7.* using API v10

Getting started

To start, you need to provide the sugar url, username and password

var sugar = require('js-sugar');

sugar.setup(url, username, password);

To verify the correct details, you can call getInfo

var loginData = sugar.getInfo();

var url = loginData.URL;
var username = loginData.username;
var password = loginData.password;

You can then login and retieve your sessionID

sugar.login(function(body, err){
  if(!err){
    console.log("SUCCESS!");
  }
});

Usage

The getOne function retrieves all of the data from one record by passing through its module (e.g. Contacts) and it's ID e.g(asdjkh1-4nabep-sdfljl-ljf12)

sugar.getOne(sessionID, module, id, callback);

getFilterData retrieves selected data from a particular module. You can visit the sugarCRM REST API v10 documentation for how what to pass through with data

sugar.getFilterData(sessionID, module, data, callback);

These CRUD function can be used to create, update and delete records by passing through the relevant data and/or id

sugar.createRecord(sessionID, module, data, callback);
sugar.updateRecord(sessionID, module, id, data, callback);
sugar.deleteRecord(sessionID, module, id, callback);

The ability to follow and/or favourite a record can also be done by using the following functions

sugar.followRecord(sessionID, module, id, callback);
sugar.favoriteRecord(sessionID, module, id, callback);
sugar.unfollowRecord(sessionID, module, id, callback);
sugar.unfavoriteRecord(sessionID, module, id, callback);

The global search function can also be used by passing through the appropriate variables as a JSON into searchData

sugar.search(sessionID, searchData, callback);

Finally, after you have finished with the data, be sure to log out of your current session

sugar.logout(sessionID, function(err, body){
  if(!err){
    console.log("LOGOUT SUCCESS!");
  }
});

js-sugar's People

Contributors

bmpickford01 avatar bmpickford avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.