Questions tagged [api]

Questions about the CiviCRM API.

Filter by
Sorted by
Tagged with
3
votes
0answers
102 views

Get date in CiviCRM default date format in custom Drupal module

Preamble I write a Drupal7 module which allows CiviCRM event registration form design alter. While getting a list of events from CiviCRM, the module performs some checks against events properties. ...
1
vote
1answer
73 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 ...
0
votes
1answer
55 views

Call to undefined function _civicrm_api3_basic_get when using CiviRepeat module

I am using civicrm 4.7.17 When I go to the page sitename/admin/config/civicrm/civirepeat, I get the error Call to undefined function _civicrm_api3_basic_get in Event.php on line 133 I figured out ...
2
votes
1answer
940 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
2
votes
2answers
33 views

API usage: How to change the 'participant_note' field in the Participant entry for an event

I need to update the 'participant_note' field for a few Event Participants via the API. I can't figure out how to do this using the API explorer (it seems the explorer does not recognize '...
1
vote
1answer
67 views

API URL needs administrator

I am writing an extension which uses a CRM.api3 call in javascript on the contribution page. However, the link that is generated is lacking the "administrator" part. For example, The API call to ...
2
votes
3answers
223 views

post hook edit entity

We have a post hook that sends some data to an external api when a participant is created or edited. function kavo_civicrm_post($op, $objectName, $objectId, &$objectRef) { if (($op == 'create' |...
1
vote
2answers
79 views

How to extract field from an array returned from an API3 call

I am trying to extract a custom field from a contact record. The API returns an array of the following form: Array ( [0] => 0 [1] => 3 [2] => array ( [0] => array ( ...
0
votes
2answers
71 views

Help needed in setting up rest api in CIVI CRM

I tried below steps but I am getting an error in calling rest API via the browser. I checked which user is an administrator and added api key via phpmyadmin interface. Get the site key from CiviCRM ...
1
vote
1answer
22 views

Mailing behavioural data throgh API

How do I get mailing behavioural data through the CiviCRM data through the API? Like number of bounce per mailing job or number of opens.
2
votes
1answer
138 views

CiviCRM Integration with SMS Gateway custom API

How to send SMS using the API when the CRM user will open a new case. The SMS gateway has it's own API and I know how to integrate with it. I tried to edit in the code but it's very big what's ...
3
votes
1answer
116 views

Why do I need so extensive permissions for getting event participant via API?

I'm trying to get participant info via CiviCRM API like this: civicrm_api('Participant', 'get', array( 'version' => 3, 'sequential' => 1, 'contact_id' => $contact_id, ...
1
vote
1answer
70 views

Dependant autocomplete civicrm

Working on custom enhancement, two text fields Parent and Child field. Existing:- Parent autocomplete - lists all existing contacts Child autocomplete - list all existing contacts Required:- ...
1
vote
2answers
81 views

CRM/Core/Config.php line 41 throwing 500 error with new require_once api/api.php

Just updated our WP install from 4.7.22 to 4.7.23 -- but can't run the db update script, because whenever I rename the 4.7.23 folder to civicrm, I subsequently get 500 internal server errors while ...
1
vote
0answers
65 views

Wordpress custom contribution and newsletter signup forms

How customizable are the contribution forms? I have created a standard contribution page from the CiviCRM plugin, but I would like to hammer it into a very stylized design. Alternatively, is it ...
2
votes
1answer
124 views

inner join using api3 chaining

I am trying to use api3 to get all participants to an event of a certain type. In SQL I would use an inner join for this, using api chaining I do: $result = civicrm_api3('Participant', 'get', array(...
3
votes
2answers
64 views

Different Result in Code Than API Explorer

I am trying to get data out of the API and when I look at it in API explorer I find what I am looking for but the data is incomplete in my module. For example, I am using civicrm_post($op, $...
4
votes
1answer
33 views

How do I see which permissions are necessary to execute a given API call?

If I pick a random entity and action, what steps can I take (manually if necessary) to see which specific permissions are necessary for CiviCRM to execute an API call with check_permissions=1?
3
votes
3answers
170 views

Updating a custom field set for case entity Civi API

I have defined a custom field for a particular case type ("adhesion") it's a yes or no field that I need to update when I finish the processing. So I use the Case API to update it passing the id and ...
2
votes
1answer
122 views

Using CiviCRM API in Drupal View

I am trying to use the Civi API within a Drupal view, in the global PHP field. It is all working, except for when I try to use an "Available Variable" from the view, it throws and error. When I hard ...
3
votes
2answers
71 views

How do I write the _spec function for my custom API?

When I run... civix generate:api foo bar ...civix generates the following code: function _civicrm_api3_foo_Bar_spec(&$spec) { $spec['magicword']['api.required'] = 1; } From this example, I ...
1
vote
1answer
37 views

Confused About API Results

Right now I am using the API Explorer (in 4.7.21) just to get the pieces I need for some custom code in Drupal. I am just very confused about what the API Explorer is returning. I am guessing this ...
1
vote
1answer
112 views

How to handle conditions in API

I have created a API. In this a simple select query is running and data is displaying as JSON format But I don't how to handle / pass all the conditions to the select query Parameter = 1 or ...
0
votes
1answer
473 views

Getting Custom field values via API using chaining

I am trying to use the API to get membership data, including some custom fields. I have the general idea, I think. I can successfully retrieve the memberships, chained in the contact data, and now I ...
1
vote
2answers
415 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 ...
1
vote
1answer
149 views

REST API - json and chaining issues

I am having two issues w/ the REST api via curl. 1) API is ignoring json attribute. If I do not urlencode, I get a "Unable to decode supplied JSON" return msg. When I do encode, as shown below, I ...
3
votes
1answer
58 views

The apiv3 does not return joined fields

Not much doc on API and joined table fields... Any special reason I can't get the contact's primary address in a membership query... Basically this $result = civicrm_api3('Membership', 'get', array( ...
3
votes
0answers
25 views

How are API calls logged consistently as a specific user?

I wrote some extensive scripts that are run through drush. I use the --user= switch in the drush command that supposedly runs the script as that user. The chosen user has a CiviCRM contact ID too ...
0
votes
2answers
34 views

Silent error when accessing php API has not logged in user

I'm having a strange problem using the CRM API thru PhP (i.e. not REST or AJAX). I'm trying to build a donations counter which tracks the total amount of contributions made under a specific ...
2
votes
1answer
352 views

AJAX API permissions

We are using REST urls to pull data direct from Civi reports into Excel for analysis purposes. Within Civi the users are restricted via granular ACLs to specific groups of contacts. WP role ...
2
votes
1answer
99 views

Can the API be used to find contacts with multiple tags?

If I tag a contact as a Major Donor and a Volunteer, I can retrieve their contact ID via the API using an API call such as: $result = civicrm_api3('EntityTag', 'get', array( 'entity_table' => "...
0
votes
1answer
39 views

Using data from CiviCRM to change filename

Here is what I need to do: The user uploads an image, and I need to change the filename of the image to be firstname_lastname.filtype. The first and lastname are stored within CiviCRM, but the ...
1
vote
0answers
32 views

How can I get donation amounts for a Contribute Page or Event via API?

Is it possible to retrieve amounts on a contribution page via API only? I can retrieve the details of a CiviCRM Contribution Page via API. cv api ContributionPage.get id=1 A missing detail I'd like ...
2
votes
1answer
49 views

How can I customise site search settings to use a wildcard for a specific entityRef field?

Is it possible to override the site search settings with respect to the wildcard search, for a specific entityRef field? We have the site search setting configured with wildcard search disabled. On a ...
2
votes
1answer
53 views

Invalid Date with Contribution API and Custom Date Field

Using the API, I try to create a contribution record. One of my custom fields is a date field. If I set the date to more than 20 years or so past the current date, I get the following error: [...
1
vote
1answer
47 views

how to access nested array

how can I access the values in a nested array, e.g. when using get for contact entity e.g. how can I adjust the following to get the first name? (not working for me at the moment) $result = ...
3
votes
1answer
137 views

Using API to retrieve contact records by modified date

I basically have the same questions as described in these topics https://forum.civicrm.org/index.php?topic=22774.0 https://forum.civicrm.org/index.php?topic=24121.0 I would like to know which ...
2
votes
1answer
25 views

What is the pattern used to name the fields accessible through the API?

I'm getting familiar with the API and having trouble understanding the pattern used to name fields. A call like CRM.api3('Address', 'get') makes sense to me because the fields in the result are (1) ...
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 ...
3
votes
1answer
126 views

How can I use the API to set a field to NULL on an existing record?

Let's say I have a contact which exists and has id = 12345. I can use the API like this... CRM.api3('Contact', 'create', {"id": 12345, "nick_name": "Bob"}); to change the contact's nick name. Cool. ...
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', ...
2
votes
1answer
160 views

How to update multiple records with API?

For doing updates to multiple contacts using the API, is there a better way than this? $res = civicrm_api3('Contact', 'get', $params); foreach ($res['values'] as $contact) { civicrm_api3('Contact', ...
0
votes
1answer
79 views

How does one call civicrm_api3_system_check API

What are the valid parameters to pass to civicrm_api3_system_check($params)? Passing $params = false or $params = array() causes an infinite loop despite my try catch. ../civicrm/civicrm/api/v3/...
1
vote
3answers
67 views

CiviCRM mail sent 200% of intended recipients. Why?

It is CiviCRM 4.6.14. The mailing was scheduled via the api as per this stackexchange question. It appears to have sent all the messages twice. Any ideas why? See report.
0
votes
1answer
22 views

How do I schedule a mailing to run in a couple of hours time with the CiviCRM API?

I'd like a delay before sending out an automated email. API call as per stack exchange question. The data passed as $params seems OK. 2 hours in the future. The database has the correct time. ...
4
votes
1answer
87 views

How to control API4 permissions for CRUD operations?

How do I control permissions for API4 calls?
1
vote
3answers
158 views

CiviCRM API: How to get event by custom multiselect field option?

I have an event with a custom field custom_1 which is a multi select or checkbox list with two options Category A and Category B: "custom_1": [ "category A", "category B" ], Now I'm trying to ...
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....
1
vote
1answer
36 views

Why does this use of the API for Events work in the Explorer, but not in the Message Template?

I'm trying to use the CiviCRM API to show a list of upcoming events (in the confirmation email a user receives when they sign up for an event). When I try the operation in the API Explorer it ...
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 ...

1
3 4
5
6 7
10