Questions tagged [api]

Questions about the CiviCRM API.

Filter by
Sorted by
Tagged with
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?
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. ...
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 ...
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":...
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 ...
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 ...
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 ...
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 ...
3
votes
1answer
105 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
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
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 ...
3
votes
1answer
318 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
94 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
2answers
346 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 ...
2
votes
1answer
168 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
1answer
147 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='...
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 ...
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 ...
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, '...
1
vote
1answer
63 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 ...
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', ...
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 ...
4
votes
2answers
108 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
1answer
108 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?
2
votes
2answers
191 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 ...
1
vote
1answer
187 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
56 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
587 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 ...
0
votes
1answer
107 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
27 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?
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
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&...
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 ...
4
votes
1answer
97 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
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
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'...
3
votes
1answer
60 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 ...
3
votes
1answer
126 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 ...
2
votes
1answer
309 views

How to use the API to query custom fields on activities?

Looking at the API explorer on the demo site it appeared that it's possible to query custom data on activities using the API. However it seems that while the UI helps you select custom fields and set ...
2
votes
2answers
118 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 ...
1
vote
2answers
30 views

How to use PDF API in production?

(This post is following a previous question I asked and is related to ErikH's answer: https://civicrm.stackexchange.com/a/31142/6991) Context: I want to send per email an attached amended certificate ...
1
vote
1answer
159 views

Update custom field from other custom data

I'm trying to use a php hook to automatically create a relationship between two contacts. Let me set the stage for you. Meeting Extender: a custom data set that extends the meeting activity(activity ...
1
vote
4answers
134 views

CiviDiscount based on group membership

CiviDiscount gives an easy way to say, "Members get a lower price on a certain event", but I have the opposite situation - "attendees of a certain event get a discount on a membership". Can anyone ...
1
vote
1answer
54 views

Javascript Contact API - how do I 'do something' with results

Through javascript, I was hoping to check what groups a user belongs to and then use that information to show / hide something. I can't use ACLs because I'd like the average internal user to be able ...
1
vote
1answer
253 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 ...
0
votes
1answer
181 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 ...
0
votes
1answer
22 views

Does CiviMobileAPI generate any logs?

I enabled CiviMobileAPI extension and Civi CRM Api Fix plug in (I'm using Wordpress) but can't login in the CiviMobile app (iOS). It keeps showing the Server API Error (Unknown error) message. I ...
0
votes
1answer
36 views

How to update ContentType Label through API chaining?

I try to relabel Organization as "Entity": $result = civicrm_api3('ContactType', 'create', array( 'label' => "Entity", 'api.ContactType.get' => array('name' => "Organization"), )); ...