Questions tagged [api]

Questions about the CiviCRM API.

Filter by
Sorted by
Tagged with
2
votes
0answers
118 views

How to trigger USPS address standardization on API address create?

It looks like addresses created by an API call do not go through the USPS address standardization routine. Is there a way to trigger the standardization through the API? Or what is the BAO function ...
4
votes
2answers
97 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 ...
2
votes
4answers
695 views

How to check if DB table exists?

Is there a built-in way to check to see if a DB table exists via PHP? I'd like to add that to my API call and create the table if necessary. Thanks!
1
vote
2answers
374 views

How to Insert html in custom field (type TextArea) via API

I have a custom field with data type 'Note' and field type 'TextArea'. When I insert a value using the CiviCRM interface, I can insert text via an editor, and bold text gets displayed as bold, italic ...
1
vote
3answers
150 views

How to retrieve contact image URL in CiviCRM with the API

I'm trying to retrieve contact with the below api call CRM.api3('Contact', 'get', { "return": ["image_URL","first_name","last_name"] }).done(function(result) { // do something }); but my image ...
1
vote
0answers
37 views

How do you create a scheduled mailing with recipients through CiviCRM API? [duplicate]

I am trying to create a scheduled mailing through the CiviCRM API. Here's my code: $params = array( 'sequential' => 1, 'created_id' => $contact_id, 'created_date' ...
1
vote
1answer
69 views

Case status change to a closed status does not update the end date and relationships of the case

When I change the case status with the API to a case stated which is Closed. Then the end date of the case and the end date of the case roles is not set. When I change the case status from the user ...
1
vote
1answer
59 views

How to sort a varchar numerically using the api

I'm trying to find the activity_type with the highest value, so I can ++ that value and insert a new activity type. I thought this would be easy. I cannot sort on the "value" column of the ...
3
votes
1answer
249 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
0answers
60 views

Memory leak in bulk actions

I've recently being doing some bulk import/export/delete using the /civicrm/import/contact for import/export /civicrm/contact/search/advanced for delete I've done some timings for the bulk delete ...
4
votes
3answers
649 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 ...
3
votes
1answer
42 views

What are the core functions an extension can rely on?

It's been said, quite reasonably, that all APIs should have tests, and that if a feature doesn't have tests then coders shouldn't rely on it. This raises two three questions: other than direct "API3"...
2
votes
2answers
149 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 ...
3
votes
1answer
43 views

Documentation on the _civicrm_api3_* _spec functions

I have a working extension with a working API hook civicrm_api3_contact_getclif($params), but I can't find the documentation for the _spec function beyond the suggestion to have one I wrote this ...
1
vote
0answers
38 views

Creating event with address and fee details with event create API(single request)

Am want to use civicrm event create API to create an event with address and fee information but it's adding event data(to civicrm_event table) only, address and fee data not created. Is it possible ...
2
votes
4answers
53 views

Send a single mail to fundraising responsible

I want to send a single mail to a responsible address when a certain event occur in my extension. I had a look to some API (Email, Mailing, MailingAB) but but none of these seem to be the right one. ...
2
votes
1answer
188 views

Get actual value instead of ID in Address API for Country and State/Province

When am getting some entity using API, it's returning id reference only not the actual value. eg: $result = civicrm_api3('Address', 'get', array( 'sequential' => 1, 'conatct_id' => 10 ...
0
votes
1answer
38 views

CustomGroup Create API Not Passing Param extends_entity_column_id

I am using the API to create a custom group that extends "Participant". I want to set it to be based on Participant (Event Type). I set the "extends_entity_column_value" and "...
2
votes
1answer
51 views

using api.getoptions to retrieve all options for a field (even disabled)

According to the documentation (https://wiki.civicrm.org/confluence/display/CRMDOC/Pseudoconstant+(option+list)+Reference) I should be able to pass a context to an api.getoptions call in order ...
1
vote
1answer
169 views

CiviDiscount "Specify api string for advanced filter"

I'd like to use CiviDiscount to create an automatic discount based on a custom data field on the contact record. Looking at the options for the Automatic Discount, there is a field called "Specify ...
1
vote
1answer
199 views

API for Event Registration with Custom Fields?

I am trying to register event participants from code. I have created a custom field group for "Participants". Using the API, how can I create a value for the custom fields and have them associated ...
1
vote
1answer
206 views

API - Create a contact from an external site

I have the need to create/update a contact from an external site. If I understand correctly, the only way to do this is to use Rest API. In my test I had no problem to read the database, but when ...
2
votes
2answers
161 views

Make the Contact create API behave like UI in the way in checks for duplicates

I am creating a contact using CiviCRM API, what I have noticed that the duplicate checking looks inaccurate compared to the check done when entering new contacts via the User Interface. Under the ...
3
votes
2answers
1k views

How to use the REST API with curl

Ok - it's my first time diving into REST API - First of all trying to get it to return me just the data for one specific contact. It works great in the browser but on the command line no matter what I ...
2
votes
2answers
50 views

Can API Return Reverse Results?

I am using the CustomValues Get API I would like to have the most recent entries listed first. Is there a way that I can sort results in reverse when placing an API get? For example, below I want ...
1
vote
0answers
97 views

Chain API call multiple parameters issue

We haven't been able to get executed "is_active" parameter here: "api.Relationship.get": "is_active":1,"relationship_type_id":59} while "relationship_type_id" works. Here's a full query: CRM.api3('...
1
vote
1answer
34 views

Creating activities in code adds extraneous contact to 'with' field

So we create an activity when a contact 'refers a friend', we want it on both users Contact. This is working thus: $activity = civicrm_api( 'Activity', 'create', array( '...
4
votes
0answers
55 views

Will unsupervised dedupe rules be used in API Contact create?

I want to import an old database using API Contact create. In the de-dupe rule documentation it mentions "They are also used when you Import contacts". I see in the API documentation that there exists ...
2
votes
1answer
106 views

Impossible to get the source field with the Contribution API

On CiviCRM 4.6.11. I need to get the source field of a contribution, but the api seems to fail. Testing the API on http://xxx//civicrm/api#explorer with entries giving the following PHP code : $...
4
votes
2answers
100 views

Can I mock the CiviCRM API for unit tests?

Suppose I want to mock the API in unit tests for my extension, can I do that? Or should I implement an interface myself that is just a wrapper around civicrm_api3, and create mocks of that interface? ...
2
votes
1answer
2k views

Contact Form 7 API plugin

Trying to do a contact form in WordPress, and failing on tiny little things. A Profile using the Notes field sends an e-mail that always attaches only the first Note on a record. Creating a custom ...
0
votes
1answer
33 views

CiviCRM Contact,get with group - change in result format

Where (which JIRA issue, if any) did this change in API behaviour come from, and was it documented/expected? The same Contact,get API call returns different results between 4.6 and 4.7. IMO the new ...
3
votes
2answers
158 views

Updating an option value with drush cvapi

I'm suprised that it is so hard to update an option value in a certain group using our API. I have been writing scripts as follows: get option group id where option group name = X (save as ...
2
votes
1answer
102 views

How to use API to bulk delete contacts quickly?

In development I would like to use the API to delete all contacted except conctact_id 1 and 2. With Contact This: $result=civicrm_api3('Contact', 'delete', array( 'id' => array('NOT IN' =&...
3
votes
1answer
137 views

How can I display detailed Authorize.net error code info from civicrm_system_log in the Civi interface?

We're on Civi 4.6.21 and Drupal 7. We use Authorize.net for payment processing. Error messages from Authorize are displayed in civicrm_system_log in the context field as json encoded data. The error ...
1
vote
1answer
83 views

How can I search by relationship in Contact.get?

Is there a way to search by relationship in the Contact.get API call? Eg: give me all the contacts that are individuals, in group 9 and have a relationship type 8 (optionally specifying direction and/...
2
votes
0answers
55 views

Find contacts with multiple relationships of same type

We try to gather total number of users of same Relationship Type but different number of Relationships (mean, user can be a Member of no / 1 / 2 3 .. etc. Organisations). Here's a code we use: $...
1
vote
0answers
122 views

How to programatically add an email to a newsletter?

I am migrating from MailChimp to CiviCRM with Sparkhost (seemingly a great option for installations on Bluehost or other hosts which don't support VERP.) I have a few places where the MailChimp API ...
3
votes
1answer
435 views

Getting a Custom Field Value on a Contact with Javascript API

I have a custom field for contacts that I would like to retrieve the value for using JavaScript. Using the API explorer I have generated the code that does this. It works PERFECTLY from the API ...
3
votes
1answer
190 views

Retrieve all phone info through PHP object-oriented API

How can I retrieve all the phone numbers for a contact using the PHP object-oriented API? I'm only seeing the primary phone available in the API explorer. I want to be able to create a directory of ...
1
vote
3answers
98 views

LIKE search in API for membership_type_id

Is it possible to do a membership get api request with a "LIKE" operator with wildcards for membership_type_id? Trying this out, I get CiviCRM_API3_Exception: [2001: 'Something%' is not a valid ...
0
votes
1answer
56 views

Setting up API access for WordPress installation

I'm using civicrm's API to pull country and state data from CiviCRM into a Gravity Forms address pull-down list. The current webhooks between Gravity Forms and CiviCRM are failing because Gravity ...
0
votes
1answer
139 views

Should the API return code always be 200?

The Civicrm API seems to always return 200 (aka 'Success') even when there is an error (in the parameters of the request, or otherwise). To indicate an error, it instead sets the 'is_error' flag to '1'...
3
votes
1answer
75 views

Inconsistency with date fields in the API

I've been working on an extension for civicrm and am using the API to retrieve fields to be used in forms presented to the end user. I am using the 'html.type' returned to determine which type of ...
1
vote
1answer
39 views

Suspected external REST API not updating Drupal entities

We're trying to push a Civi contact's data into an LDAP data store using the Civi Drupal entity module and the Drupal ldap module. That part works fine. If a user updates their contact card using a ...
1
vote
1answer
90 views

Programatically obtaining a Profile's HTML Snippet

Using the administrative dashboard I can obtain an HTML Form Snippet for any profile which I can use to embed in any webpage or context. This is an extremely useful feature. Is there any way to ...
2
votes
1answer
93 views

Unable to change contribution status using API

I am attempting to update a contribution's status but I am getting the error "Cannot change contribution status from Pending to In Progress." I am doing this through the API. I understand there may be ...
2
votes
2answers
703 views

Civix reports "Failed to locate civicrm.settings.php"

I used the command civix generate:api Civicrmzapier submit to an API function to an extension i am working on, but got the following error as on the screenshot and the api function is not added. ...
1
vote
2answers
33 views

CiviCRM API page not displaying in Drupal

I am developing for Gsoc this year and i got up one day to use the API explorer but the page somewhat fails to load. below is a screen-shot of the display
0
votes
1answer
43 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"), )); ...

1
4 5
6
7 8
10