Questions tagged [api]

Questions about the CiviCRM API.

Filter by
Sorted by
Tagged with
18
votes
3answers
2k views

How do I get more than 25 records from the API?

I'm making a normal api call such as: $params = array( 'version' => 3, 'sequential' => 1, 'membership_type' => 1 ); $result = civicrm_api('Membership', 'get', $params); But I only get ...
15
votes
6answers
575 views

What's the best way to import memberships and their associated contributions?

I have a load of Memberships to import. Each has a linked Contribution. While I can import Memberships and Contributions separately, I cannot find a way to import the two together - in other words ...
13
votes
4answers
2k views

Get current contact id?

I display the summary page for a civicrm contact and I need to get the current contact id. Is there any built in function for that? I have this code where I explicitly refer to the civicrm id 4. ...
11
votes
3answers
459 views

Get or generate a contact checksum via API?

Is there a way to view or generate a Contact's checksum via the REST API? I'm looking to use the checksum to provide relevant form links, etc., but need to get it programmatically on a Contact ...
9
votes
2answers
910 views

How do I import contacts through the command line?

How can I import contacts in CiviCRM using the command line (CLI) rather than using the CiviCRM user interface and its importing wizard?
9
votes
0answers
109 views

Can anybody volunteer to test my Android App: Cividroid - A CiviCRM companion on Android!? [closed]

I am working on an Android App for CiviCRM: Cividroid - A CiviCRM companion on Android! as a GSoC 2015 project. I am not a regular CiviCRM user and hence I don't have a live environment to test the ...
8
votes
1answer
239 views

Can I easily sync/import Facebook Event attendees with a CiviCRM Event participant list?

A lot of my users like to use Facebook Events for quickly inviting their friends and contacts to an Event. Facebook allows Event attendees and status to be exported by the Event owner or manager - ...
7
votes
2answers
126 views

How is the restful API secured?

In order to access the API securely what do I need to do? Is it as simple as using https and letting my CMS manage session authentication?
7
votes
4answers
304 views

Where is the CiviCRM ERD / data-dictionary?

In a variety of contexts it is useful to have a Entity Relationship Diagram (ERD) / data-dictionary: Using the API (Xavier avert your eyes) querying the database with SQL Developing extensions; and ...
7
votes
2answers
675 views

REST API: Unable to decode supplied JSON

REST API works, but I cannot pass json parameter to it, getting "Unable to decode supplied JSON". I am running CiviCRM 4.6.8 on Wordpress. I have properly identified SITE KEY and API KEY, and I can ...
7
votes
1answer
172 views

Incoporating PCPs in Wordpress

I'm trying to write some plugins to incorporate PCPs (mainly lists of them) into my Wordpress sites. I did not see in the API explorer any coverage of PCPs. (I could be blind, please feel free to ...
7
votes
2answers
320 views

How to get the new record ID, when adding a record to a multi-value custom field using the API?

The API calls I know of that add a record to a multi-value custom field, don't return the ID of the added record (which you can then use to access the value for the specific record in the form ...
7
votes
1answer
111 views

Can I pass a GROUP BY to an API call?

I'm trying to write an API call returning all contacts that are at one end of one or more active relationships of a certain type, and their names. I note that you can specify limit, offset (LIMIT) and ...
6
votes
2answers
2k views

How do I set up an API key for a user?

The current documentation for creating an API key for user is on the wiki at https://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface#RESTinterface-CreatingAPIkeysforusers. Unfortunately ...
6
votes
1answer
215 views

What is the join logic when using API chaining with action = get?

I read about API chaining and I'm using it with get actions to learn more about how it works. I'm confused by the inconsistent behavior of the following two API calls: CRM.api3('participant', 'get', ...
6
votes
1answer
407 views

How to permanently delete contact with API?

I'm creating an automated test script. It creates a test contact, does some stuff, then cleans up after itself by deleting the contact. However this still leaves the contact in the "Trash". How can ...
6
votes
4answers
640 views

What is the correct way to work with custom data in the API?

I always seem to struggle to find a concise way of working with custom data via the API. I know that something like... $updateParams = array('version' => 3, 'contact_id' => $contact_id, '...
6
votes
4answers
203 views

API: How do I delete a custom value?

I may be blind but I can't see any api call to delete a custom value?! CustomValue entity is missing a delete action. What am I missing?
6
votes
2answers
121 views

Can I auto update Civi data w/ data from my listserv?

has anyone integrated an email listserv with CiviCRM? It would be nice to have a Civi group of 'advisors' and also a listserv, and when there are changes to subscriptions on the listserv, it is ...
6
votes
2answers
149 views

How do I use the API to access protected custom data in a hook?

I have custom data for events that is not visible to anonymous users (it's for internal use only). I want to access that data from my implementation of hook_civicrm_post(). When I call the API "get" ...
6
votes
2answers
97 views

Get URL of custom image field

I would like to display pictures which are defined as custom "File" fields within an event. I currently to this by generating URLs having the following format: MY_URL?q=civicrm/file&reset=1&...
6
votes
1answer
151 views

Is it possible to integrate CiviCRM with a hosted VOIP solution?

My company may be moving to a hosted VOIP solution. I've been looking for a solution to integrate a VOIP system with CiviCRM but it appears that this is still under development and no solution is in ...
5
votes
2answers
366 views

CiviCRM integration with Eventbrite

I would like to create/update events in CiviEvent by using Eventbrite webhooks. One of the requirements is having an endpoint page that will receive data sent by Eventbrite API. How can I create that ...
5
votes
4answers
287 views

Are there public repos including WordPress WooCommerce and CiviCRM integration code?

On a WordPress / CiviCRM installation, we need to do a bunch of customization on its payment pages. We want to do it in WordPress since there are WordPress plugins that can help do things like ...
5
votes
5answers
389 views

Get state/provice id with API3

I wrote an custom contact import script for our NGO. The old contact data only contains valid country / state abbreviation names. For example CH / ZH = Switzerland / Zürich. When I now want to ...
5
votes
2answers
355 views

How to trigger a confirmation email when registering participants via API

We have a custom module that we use to do event registrations (non - paid), however i was wondering is there anyway through the API of being able to trigger CiviCRM sending a confirmation registration ...
5
votes
3answers
256 views

How to get all the groups for a contact

Starting from a contact ID, i need to find all the groups to which the contact belongs. I know that i can use api GroupContact but it doesn't work for smart groups (in CiviCRM 4.5) Is there any api ...
5
votes
2answers
182 views

How to renew membership during event registration?

I've set-up an event with several fee options that include "event fee plus 1 year membership renewal", "event fee plus 2 years membership renewal", etc. How do you suggest implementing the membership ...
5
votes
2answers
226 views

How to get contact id of logged-in user in JS API

Sorry if I'm being thick here, but I've looked and looked. Is there an API call to get the contact id of the logged-in user? What I need to do is check whether an activity has been authored by the ...
5
votes
2answers
86 views

How to clear pseudoconstant cache?

I find that if I create a new tag via the api, and then try to attach it to a contact with the entity_tag api, it will sometimes fail with the message "'##' is not a valid option for field tag_id". ...
5
votes
2answers
364 views

How do I get a chained restful API call to return xml?

This query string will return a contact record and related phone records for Contact ID 1234 in json format: entity=Contact&action=get&json={"contact_id":"1234","api.Phone.get":{}} How do I ...
5
votes
2answers
1k views

Get CSV via REST?

Is there a way to get CSV-formatted output via a REST call? We have a 3rd-party app that can import data periodically from a URL pointing to a CSV file, so the aim is to provide it with a Civi URL (...
5
votes
2answers
112 views

allow public access to entityRef field contact lookup

I need to add an entityRef lookup field to a public facing profile form so that users can search and select organization contacts. I patterned it after the current employer lookup in the contact ...
5
votes
3answers
193 views

What should be synced to an accounting package from civicrm?

My church uses Aplos Accounting. It's a web-based accounting package aimed at non-profits (www.aplos.com). They have recently implemented an api (www.aplos.com/api). I am interested in doing some ...
5
votes
1answer
114 views

CiviMail mailing sometimes has 0 intended recipients

I'm creating some CiviMail mailings using the API. Sometimes my mailings get created and scheduled, but when they execute, they are marked as "completed" but show as having Intended Recipients: 0 in ...
5
votes
2answers
126 views

Does the Civi GoCardless extension use the GoCardless API?

We're a charity running CiviCRM 4.6 on Drupal 7. Last year, we moved all of our direct debits to GoCardless, which is running nicely. However, we're wanting to feed information from GoCardless back ...
5
votes
1answer
178 views

Testing a module which uses CiviCRM php api

I have written a drupal module that uses the CiviCRM api. I want to build tests for my module. Drupal 7 includes the simpletest module in core, so I'm using that. I have created the following test: ...
4
votes
2answers
227 views

Is there a CiviCRM hook or other method which can be used to push data updates to other systems?

We are attempting to keep two systems in live sync with each other, one is CiviCRM. There are hooks in civicrm for: Pre database saving of data hook_civicrm_pre($op, $objectName, $objectId, &$...
4
votes
4answers
303 views

How to set a contact's gender using API?

If I do a civicrm_api3('contact', 'getsingle', ['id'=>123]) I get lots of data, including gender. However when I try to set the gender like: civicrm_api3('contact', 'create', ['id'=>123, '...
4
votes
3answers
150 views

How do I send mailings to subsets via the API?

This is a big question :-) I'd like to be able to use the API to send mailings to subsets of groups. What is the simplest way to achieve this? Ideally I'd like to be able to define a subgroup using ...
4
votes
2answers
88 views

Is it possible to integrate a custom Drupal donate form with CiviCRM?

I'd like to build a custom Drupal form (not using webform) to use as a contribution form and want to know if it is possible to integrate it with CiviCRM. I am not very familiar with Civi's Api ...
4
votes
1answer
188 views

Can I chain API calls through drush?

API chaining works well in Javascript and PHP. For example, I can retrieve a contact's email addresses using this code generated by the API Explorer: Php $result = civicrm_api3('Contact', 'getsingle'...
4
votes
1answer
121 views

CiviCRM Ajax API - Searching by Tag

I'm working with the CiviCRM API and it's been great--I've been able to make a very useful tool for our team. However, I've encountered a problem. I would like to do a search on contacts based on ...
4
votes
2answers
70 views

How to access the APIv3 from wordpress plugin files

I'm developing a little wordpress plugin which creates a custom post type with a custom field where I would like to store an ID of one of the active contribution page of CiviCRM in order to associate ...
4
votes
1answer
102 views

Limit is ignored in civicrm_api3('Membership', 'get')

Can anyone explain why limit here has no effect? Still get 25 results every time. Also tried 'api.Contact.get' => array(array('limit' => 1000)) Using offset to recurse through the set works ...
4
votes
1answer
148 views

Upload a contact image via the API

Can someone give me a simple example of how to upload a Contact image via the API? I am guessing it will involve a call to the File API as well but not sure. I have the original image as a URL but ...
4
votes
2answers
83 views

How do I use the joins feature of the new API

4.7 lists the ability to use joins for API queries, but I can't find anything in the docs or in the API Explorer. Can someone point me to documentation or examples?
4
votes
1answer
600 views

REST API without JSON just key=value

Is it possible to structure /sites/all/modules/civicrm/extern/rest.php?entity=Activity&action=create&json={"sequential":1,"activity_date_time":"2015-09-01","id":2,"subject":"test","target_id":...
4
votes
2answers
182 views

Batch merge automation of big data set

We've faced duplicate records batch merge issue while moving big data set (around 140K Individuals as Organisation members and cca. 400 Organisations accordingly) from proprietary CRM to CiviCRM and ...
4
votes
2answers
312 views

CiviCRM API with Custom Data mixed with Standard Entities

I'm using CiviCRM 4.6 with the new API editor. I'm attempting to chain a bunch of queries together, which provide cases for a client within a period, along with the linked contact, along with custom ...