Questions tagged [api]

Questions about the CiviCRM API.

Filter by
Sorted by
Tagged with
9
votes
2answers
1k 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?
13
votes
3answers
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. ...
5
votes
1answer
128 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
1answer
812 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":...
3
votes
1answer
248 views

Inbound SMS from Twilio not showing up in CiviCRM (getting 404 error on HTTP POST)

I'm really enjoying CiviCRM (recently upgraded to 4.7.13) and was excited about its SMS capabilities. So far, I have been successful in using CiviSMS with Twilio to schedule/send bulk messages. But, ...
2
votes
2answers
564 views

What should drush cvapi NotificationLog.retry sequential=1 system_log_id=XXX do?

Trying to re-run/retry some 'stuck'/"pending" notifications in the system log using: drush cvapi NotificationLog.retry sequential=1 system_log_id=XXX but that just produces an array with the JSON ...
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
663 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 ...
6
votes
2answers
3k 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 ...
7
votes
1answer
180 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 ...
4
votes
2answers
201 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 ...
3
votes
1answer
114 views

How do I modify a core CiviCRM file (to change a search order)?

Looks like one of core CiviCRM files (namely part of mySQL query at CRM/Contact/BAO/Query.php) has to be changed in order to achieve "Search results sort by Last Name". What would be the best (I mean, ...
6
votes
1answer
246 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
4answers
326 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 ...
3
votes
2answers
145 views

What is the correct REST URL in Drupal 8 (or 9)?

I know there's been a lot of work to deprecate the extern endpoints in CiviCRM, and the extern endpoints don't work in Drupal 8 without a lot of finagling. The documentation isn't updated to reflect ...
3
votes
1answer
439 views

Uploading files through the API

I see an older thread on the forum about potential improvements to the API to allow file uploads, but I'm not sure that ever happened. Has anyone ever uploaded files in CiviCRM using the API? I see ...
3
votes
1answer
173 views

How do I get CiviCRM Mailing to submit via the API

I would like to send a mailing every time a content item is published. The mailing is not being saved. I have taken the sample code from sites/all/modules/civicrm/api/v3/examples/Mailing/Create....
2
votes
1answer
204 views

Contribution Note Smarty Variable

So I'm super close to getting a smarty variable working to place the contribution note in a thank you letter. I used the API explorer and got this far: {crmAPI var='result' entity='Note' action='...
1
vote
2answers
413 views

API permission check failed: CiviEvents Fails after update to 4.7.19 and 4.7.20

After updating to 4.7.20, when the Event Info Page is accessed, it generates the following error, "API permission check failed for Event/get call; insufficient permission: require access CiviCRM and ...
4
votes
1answer
147 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 ...
11
votes
3answers
693 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 ...
7
votes
4answers
751 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, '...
2
votes
1answer
938 views

I need to find the Host URL, Site key and API key

I need to find the following details for my CiviCRM account: Host URL, Site key and API key. Where can I find them? Thanks so much, Silvia
1
vote
1answer
80 views

Need to create a SepaMandate for street walkers?

Business logic: Customer sends out street walkers who recruit recurring donors on the streets with forms in their hands (or on their tablets). They need to create SEPA mandate reference numbers in ...
7
votes
2answers
1k 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 ...
6
votes
1answer
394 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', ...
5
votes
2answers
365 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 ...
4
votes
2answers
185 views

Attach pdf file civicrm_api3

i need help, i'm trying to attach through civicrm_api3('Attach', 'create'..) a pdf file, passed with a rest call as simply text: %PDF-1.3 1 0 obj << /Type /Catalog ... ecc . The attach works, ...
2
votes
2answers
255 views

How to set a custom country field using the API

Some fields that are stored as id references to other tables can be set by simply passing the value as an id, e.g. setting gender_id=Male works. I have a custom fieldset attached to contacts that ...
2
votes
1answer
121 views

How to link to a stored invoice pdf with civicrm api

I can see that the invoices I have created are in the civicrm/custom map as invoiceID.pdf, but how can I link to them using Civicrm api?
1
vote
1answer
289 views

Wrong return URLs in PayPal Standard

I'm using the api to process contributions from some custom pages I have created, specifically the call to civicrm_api3('Contribution', 'transact', $params). When I use PayPal Standard as my payment ...
1
vote
2answers
68 views

How to send email report FROM other than default email address?

I have a report that is sending successfully every week. Only issue is I was not able to set FROM email address for the report. It’s always sent from default email address, but I need to send from ...
1
vote
1answer
716 views

How to use API chaining to create a contact and a relationship

I've read all the docs I could find, the code examples, the 4.6 explorer, but I'm not grasping one piece. Below is code to create a new adult contact (via profile submit, to get some extra validation ...
1
vote
1answer
131 views

entityRef widget seems to not respecting params

Whatever has been tried, this code doesn't restrict entityRef widget output according to desired parameters: $selection = array(132, 168, 169); $sa_custom_props = array( 'api' => array('params' =...
0
votes
1answer
39 views

How can I skip display of repeat events on the manage events page?

I need to skip showing repeat events on the manage events section.How can that be implemented programmatically?
0
votes
1answer
303 views

How to setup Cron in Civicrm- local server

-job.execute works, cron runs when i click Execute Now -individual and group test mail works properly -curl is running -joomla 3.8.7 -apache 24 -php 7.2.4 -civicrm 5.0.1 Here's the problem: -I could ...
6
votes
2answers
254 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
487 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 ...
5
votes
2answers
599 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 ...
4
votes
1answer
103 views

Schedule reminders broken in 4.6.8

using civi 4.6.8 needed a notification sent to a volunteer when they sign up for an event. setup a scheduled reminder to catch the action. everything work ok and email was added to the queue in ...
4
votes
3answers
642 views

How to set a default value for a custom field

EDIT: this is NOT working, at least in CiviCRM 5.24.2 EDIT: this is done automatically by CiviCRM from 5.18+ I have a custom fieldset on Contributions that uses an option list. The option list has a ...
4
votes
4answers
325 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
0answers
71 views

Too many tables - MySQL limitation - CiviCRM API errors

On CiviCRM 4.6.31 We have seen CiviCRM errors with SQL LEFT JOINs relating to custom data sets. It appears there is a MySQL limitation on how many tables can be joined. This impacts on a number of ...
4
votes
1answer
50 views

Finding contacts without relationships (API)

How can I find contacts using the APIv4 that don't have any relationships of a specific type? I want the first n contacts ordered by a date field meeting various conditions excluding those with a ...
4
votes
1answer
65 views

Smarty only generating nulls from API calls

Using the Explorer, I built up the smarty code I need for a template to pull in address information on a contact for use in an email: {crmAPI var='result' entity='Address' action='get' contact_id=203}...
4
votes
1answer
224 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'...
3
votes
1answer
144 views

Where to put api wrapper class in an extension

I just wrote an extension with short-name "genderselfidentify" (it's cool, you should check it out), which implements hook_civicrm_apiWrappers. This hook requires you to declare a class for your api ...
3
votes
1answer
80 views

Under what circumstances is API joining available?

If I go to the API explorer and select ContributionSoft as the entity, I see options to enable joining. But I don't see any joining options available for other entities like Contribution and ...
2
votes
1answer
98 views

Fetch membership type along with the contact details with civicrm_api

I am trying to create a lists of contact along with the membership type associated with each contact. Below is the code I have: $result = civicrm_api3('Contact', 'get', array( 'sequential' => ...
2
votes
2answers
148 views

passing JSON objects to drush cvapi

I'm building API extension that takes complex objects as parameters. The API exporer does a brilliant job at parsing the objects, but drush less so. Commands I am trying are: `drush @contact cvapi ...