3.2.2 • Published 3 months ago

civicrm v3.2.2

Weekly downloads
6
License
BSD
Repository
github
Last release
3 months ago

civicrm

Allow to fetch data from a civicrm server. It covers all the entities civicrm api exposes (more than 80) and the basic crud methods. Yes, it can create, update or delete too.

It's assumed you are familiar with the civicrm api, checkout the documentation if you aren't sure.

To avoid running too many queries at the same time and flood the civicrm server, it has a build in queue that doesn't send more than 8 requests in parallel.

you can adjust that by setting config.concurrency = 8;

Installation

$npm install civicrm

Examples

get the first 25 individuals

var config = {
  server:'http://example.org',
  path:'/sites/all/modules/civicrm/extern/rest.php',
  key:'your key from settings.civicrm.php',
  api_key:'the user key'
};
var crmAPI = require('civicrm')(config);

crmAPI.get ('contact',{contact_type:'Individual',return:'display_name,email,phone'},
  function (result) {
    for (var i in result.values) {
      val = result.values[i];
     console.log(val.id +": "+val.display_name+ " "+val.email+ " "+ val.phone);
    }
  }
);

create a new contact

crmAPI.create ('contact',{contact_type:'Individual','first_name':'John','last_name':'Doe'},
  function (result) {
    if (result.is_error) {
       console.log('ERROR '+ result.error_message);
    } else {
       console.log('CREATED CONTACT '+ result.id);
    }
  }
);

delete contact id 42

crmAPI.delete ('contact',{id:42},
  function (result) {
    if (result.is_error) {
       console.log('ERROR '+ result.error_message);
    } else {
       console.log('DELETED CONTACT '+ result.id);
    }
  }
);

lower access

All the above actions relies on the lower level call method. You can call it directly if there is another action you need. For instance the get above can also be called:

crmAPI.call ('contact','get',{contact_type:'Individual',return:'display_name,email,phone'},
  function (result) {
    for (var i in result.values) {
      val = result.values[i];
     console.log(val.id +": "+val.display_name+ " "+val.email+ " "+ val.phone);
    }
  }
);
3.2.2

3 months ago

3.0.4

6 months ago

3.0.3

6 months ago

3.1.1

6 months ago

3.0.2

6 months ago

3.1.0

6 months ago

3.0.1

6 months ago

3.0.6

6 months ago

3.0.5

6 months ago

3.0.0

6 months ago

2.2.2

9 years ago

2.2.1

9 years ago

2.2.0

10 years ago

2.1.0

11 years ago

2.0.0

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.8

11 years ago

1.0.7

11 years ago

1.0.6

12 years ago

1.0.5

12 years ago

1.0.4

12 years ago

1.0.3

12 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago