Version 12 (modified by 11 years ago) ( diff ) | ,
---|
CiviCRM Rest API
Relevant Links for version 4.2
- Devlopers Guide API Reference
- API Reference
- Rest Interface
- Setting up a Site Key - necessary for Rest API.
- Test Server API Explorer
- Parameter list for Test Server - What parameters are available for each entity in the API.
Steps to Enable the Rest API
- Create a site key
- Create a user
- Enable the user to access the REST api
Create a Site Key
- Go to The Bit Mill
- Select Uppercase, Lowercase, Numbers, Punctuation
- Set Removals from selection as
&=+$?%,/:{}#|'
- Set length to be
32
- Edit the CiviCRM Settings file.
- For the test server this is: uhlbriccsapp04:/var/local/civicrm/drupal/sites/default/civicrm.settings.php
Using the REST API
Authentication
There is some talk in the documentation about having to log in and then use a session ID to access the REST API. However, more recent documentation says to just post the username and password with every request.
Options
Documentation is a bit sketchy about options. Here are a few things that appear to be true.
- The default maximum number of entities returned is 25
- The default maximum can be increased by including
&option.limit=nnn
in the URL. A limit of zero returns all rows. The parameterrowCount
also works (case sensitive). See here. - An starting offset can be provided by including
&option.offset=nnn
in the URL. The parameteroffset
on its own also works. ibid. - Sorting uses
&option.sort=fffff
where fffff is the name of a field returned in the JSON. The parametersort
can also be used. - The data returned can be restricted using the parameter
&return=f1,f2...etc
, where fn is a field returned in the JSON.
Note:
See TracWiki
for help on using the wiki.