Questions tagged [api]

Questions about the CiviCRM API.

Filter by
Sorted by
Tagged with
1
vote
3answers
134 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
21 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
55 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
50 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 ...
2
votes
1answer
178 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
55 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 ...
3
votes
3answers
389 views

How to set a default value for a custom field

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 default value set, but when contributions are created ...
3
votes
1answer
41 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
124 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
36 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
33 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
50 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
165 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
35 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
42 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
111 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
169 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
181 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
125 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
842 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
45 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
92 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
33 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( '...
3
votes
0answers
42 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
88 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
70 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
1k 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
22 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
105 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
82 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
105 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
62 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
51 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
106 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
315 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
173 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
84 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
42 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
93 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
53 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
34 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
73 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
75 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
495 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
38 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
vote
1answer
33 views

Can't seem to access Session values in module's API file

I can't seem to access session values on API definition. var_dump($_SESSION) returns an empty array event after putting session_start(). api/v3/MymoduleEntity.php function ...
1
vote
1answer
37 views

How to set API ContactType parent_id NULL or how to rename label?

Attempting to write prototype initialisation code I want to rename a ContactType using the API action "create". I tried to set: array ('parent_id' => 0) array ('parent_id' => '') But both error out ...
1
vote
1answer
278 views

How can I find the CiviCRM Admin API key from Wordpress CiviCRM plugin

We have got a wordpress website using CiviCRM plugin. The only thing which we have is the CiviCRM site key, but in order to implement the functionality on the website we need CiviCRM API Key. Can you ...
3
votes
2answers
156 views

CiviCRM REST API query doesn't return all fields of a 'Report'

I have been trying to retrieve reports based on default report templates through REST API calls. But the fields returned for each report instance is not same as what it is supposed to according to a ...