Questions tagged [apiv4]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
13 views

Can rename(AS) a column/field from SELECT using APIv4

I want to rename the column/fields I am retreiving in the SELECT statement. Best way to ask this is by showing an example... Given this select call: $contacts = civicrm_api4('Contact', 'get', [ '...
jsherk's user avatar
  • 573
0 votes
0 answers
8 views

Postman Setup for API v4

Can someone help provide examples of how to set up a couple of quick APIv4 calls using Postman? I seem to be having issues testing out v4 (v3 calls are ok). This is my setup: It's a POST call using ...
Paul B's user avatar
  • 817
0 votes
1 answer
39 views

Upgrading to CiviCRM 5.71.1 from 5.70.2 causes a crash (Segmentation fault)

I'm using Drupal 10.2.4 with Apache 2.4, PHP8.1.2 and MySQl 8 I have just tested locally on Docker upgrading from CiviCRM 5.70.2 to 5.71.1 and get an immediate crash. Here is the Docker output: 2024-...
ChumKui's user avatar
  • 757
0 votes
1 answer
32 views

Retrieving Contact information with API4 Inside the module

I am developing a simple module that hooks into Membership Create, and then uses the information of the related contact to perform some other functions, like initiating a NextCloud account with the ...
Kamyar's user avatar
  • 13
1 vote
1 answer
78 views

Do strings used in API version 4 need to be escaped?

When running something like this: $result = civicrm_api4('Event', 'get', [ 'select' => ['id'], 'where' => [ ['OR', [ ['title', 'LIKE', $keyword], [...
marcelo2605's user avatar
0 votes
0 answers
21 views

API v4 : Caught Exception: Invalid Field

the CiviCRM version I'm using is 5.52.3 (Wordpress), I have created an API v4 to retrieve Contact under a PHP code and was put in shortcode in one of the page under Wordpress. It was working fine, I ...
Learn CiviCRM's user avatar
3 votes
1 answer
97 views

civicrm_api4: How do I create a Contact with Tags (EntityTag)?

Creating a CiviCRM contact using "Chaining" for a group works, but not with Tags (EntityTag), any idea why? If I remove the chain using EntityTag the contact is created. here is the error: ...
Jeremy M's user avatar
1 vote
1 answer
68 views

Get Phone or Email with API4 not possible?

I played around with the ApiExplorer for API4 While the doc says default select would be * it doesn't return all contact details. So I added the SELECT for phone_primary and email_primary and joined ...
Gesko's user avatar
  • 11
0 votes
2 answers
41 views

Can we get distinct by using API4?

Is it possible to get distinct using apiv4? For example $result = civicrm_api4('Contact', 'get' <- getdistinct? Thanks
Learn CiviCRM's user avatar
0 votes
1 answer
23 views

Can't store is_confirmation_enabled via API

I can't for the life of me store the value of is_confirmation_enabled for creating a new event via API. This is in a PHP file that creates new events on the front end of Joomla based on input ...
MtnPavlas's user avatar
  • 846
2 votes
1 answer
41 views

Use Order API or use APIv4?

I am using a script that creates a MembershipPayment to connect an existing Membership to an existing Contribution (bugfix for CiviSepa). This script produces the following error: Deprecated: Not ...
emma's user avatar
  • 493
1 vote
1 answer
22 views

Api get all option within sub entity

get all options from a sub entity named payment_instrument within a entity called OptionGroup
James's user avatar
  • 11
0 votes
2 answers
46 views

Creating extensions for custom tables

we have some custom tables and in the menu, Support -> Developer -> Api Explorer v4, currently those custom tables are not available. Since we are new to this, in order for those custom tables ...
Learn CiviCRM's user avatar
1 vote
0 answers
15 views

API 4 problem while running composer

everybody. Since the installation of CiviCRM I have problems in composer. Another installation, on the same VPS, is not causing any problems. The website is a Drupal based one (9.5.10) I started it ...
Alessandro Bronzo's user avatar
1 vote
1 answer
66 views

Invalid field 'contact_id.is_deceased' Apiv4

CiviCRM 5.61.2., wordpress. Hovering over icons on search results page brings "where was an error processing your request.." message and Invalid field 'contact_id.is_deceased' message ...
yurg's user avatar
  • 2,005
0 votes
2 answers
68 views

Get uploaded file full URL via API v4

CiviCRM: v5.57.3 (Currently waiting for a 3rd Party plugin to be updated to be compatible with the latest version.) WordPress: v6.2.2 We have a custom field attached to CiviEvents that lets the team ...
Michael Bragg's user avatar
2 votes
1 answer
24 views

CiviCRM API v4 didn't recognized php variable

I was new to CiviCRM, I have the following where %search is a variable in the php, it didn't return anything, is it true that cannot passed parameter in this way? Thanks $contacts = civicrm_api4('...
Learn CiviCRM's user avatar
0 votes
0 answers
66 views

CiviCRM: access AJAX API not respected in Wordpress

CiviCRM 5.58.1, vanilla WordPress 6.1.1 with the default theme. Both CiviCRM: access AJAX API and CiviCRM: access CiviCRM backend and API are checked. Still, executing CRM.api4('Contact', '...
yurg's user avatar
  • 2,005
0 votes
0 answers
24 views

api pull custom field value based on id not label

Using API 4 (php), how do I retreive a custom field value for a specific contact, using the custom field id instead of the custom field name. This works (for contact with id=1234), but requires the ...
jsherk's user avatar
  • 573
0 votes
1 answer
24 views

retrieve event registration link with api v4

I'm retrieving event details for a plugin, and thanks to some help here, I am now using the correct API to access the information. However, I am currently using the following to generate a ...
Paul Dufresne's user avatar
2 votes
1 answer
95 views

How can I Add a File to an Activity in API v4?

I create activities using the API, and now I need to add an uploaded file (meaning it was uploaded in a Drupal form) to the activity. I tried this: $results = \Civi\Api4\Activity::create() ->...
Hershel's user avatar
  • 735
1 vote
1 answer
24 views

Delete On_Hold emails and reassign Primary Email

We are doing a bit of DB cleanup and one area we are evaluating is on-hold emails. I have run some tests on our staging site and I think we have a good path forward to remove them. However, if the ...
zach's user avatar
  • 315
2 votes
1 answer
57 views

APIv4 Base URL for external applications

I am trying to write an external app with python, that should make a call to the CiviCRM's APIv4 to get a list of contacts & relationships. I am using CiviCRM's with Wordpress and debian 11. ...
Rafa Gomez's user avatar
0 votes
0 answers
45 views

We are testing/evaluating CiviCRM Spark, but I can't get APIv4 to work

I'm not asking for tech support (sort of), I just need to know if the functionality is there. Checking the "Extensions" I see that API KEY MANAGEMENT is not Enabled. I'm not sure if we are ...
James F's user avatar
  • 21
1 vote
1 answer
158 views

How to leverage Authentication Guard for APIv4 calls

I'm working on converting an app that was built against the REST APIv3 to use REST APIv4, and I've found the APIv4 documentation quite lacking. Through trial and error, I've determined that ...
Mmm's user avatar
  • 111
1 vote
1 answer
15 views

Recurring Contributions count not match: "Find Contributions" vs API4 Contribution::get

Api call below returns 1078 contributions $contributions = civicrm_api4('Contribution', 'get', [ 'select' => [ 'row_count', ], 'where' => [ ['contribution_recur_id', 'IS NOT NULL'], ['...
yurg's user avatar
  • 2,005
1 vote
2 answers
58 views

Php Standalone Skript doesnt Query Database, APIv4 Simple Example

I tried to write a Standalone PHP-Skript for CiviCRM and looked after the Simple Example, but unfortunately it doesnt return something. <?php require_once '/var/www/html/wp-content/plugins/civicrm/...
gzwg's user avatar
  • 37
1 vote
0 answers
136 views

Class 'Civi\Api4\Event\Subscriber\SearchKitSubscriber' not found

I've been finding recently that our cron is often failing. Our host doesn't keep output from the cron processes in the logs, so it's hard to establish the differences between the times that it works ...
somnolentsurfer's user avatar
0 votes
1 answer
35 views

Odd REST API result

I am using civicrm on drupal 7. I have configured my Civi instance to accept external REST API calls with authentication. I want to get all the values from a set of custom fields associated with an ...
tanbog's user avatar
  • 317
2 votes
0 answers
191 views

API v4 REST on Wordpress not returning any data

Problem: I am attempting to use my CiviCRM instance's API v4 REST endpoint to get and post data. I eventually want to script tasks like importing new contacts and event registrations using Python, but ...
SunriseGV's user avatar
2 votes
1 answer
39 views

How to get Price Sets related to a Contribution Page using API 4

I am trying to use the API 4 to get all the related Price Sets for a given Contribution Page. I am having a hard time with this, being new to the API and the join function. Any help? In API 3, Price ...
lapmir's user avatar
  • 61
0 votes
1 answer
105 views

How to remove APIv4 extension

Sorry if this has been asked before, but I couldn't find it if so. How can I remove the obsolete APIv4 extension cleanly? There's no disable or uninstall uption on the Extensions page. Thanks.
Jern's user avatar
  • 1,300
1 vote
1 answer
77 views

Is the use of API4 already recommended?

I am currently working on a custom module for CiviCRM (5.48) and Drupal 9 (9.3.9) I opted to use API4 but I notice that some things are missing compared to API3: Contribution -> ...
Wouter H.'s user avatar
1 vote
1 answer
282 views

API4 PHP Fatal error Uncaught API_Exception Authorization failed

So I was happily programming and testing away, and everything was working and then suddenly I started getting this error: PHP Fatal error: Uncaught API_Exception: [0]: Authorization failed thrown ...
jsherk's user avatar
  • 573
0 votes
2 answers
177 views

Using API4 to get contact based on email match

The API Explorer is excellent for testing proper queries, but I can not figure out how to get a contact based on matching email address. For example, I can get a contact based on a partial match of ...
jsherk's user avatar
  • 573
1 vote
1 answer
23 views

Is acl entity role available in Api4 explorer?

I'm pretty sure the acl_entity_role entity is supported by CiviCRM APIv4. Why doesn't it appear in the entity list on civicrm%2Fapi4#/explorer/ ?
MikeSteigerwald's user avatar
2 votes
1 answer
35 views

API4 GroupContact does not update Subscription History?

When I use the API4 GroupContact update I do not have the option to change the date of the change (which is kept in civicrm_subscription_history). Also, when I use the update to set the status to ...
ErikH - CiviCooP's user avatar
1 vote
1 answer
71 views

Make API queries - two methods failing

I'm trying to query my data for records with a given firstname/lastname pair (see Map firstname-lastname pairs to IDs for some previous context) using a couple different methods, and failing. API4 The ...
Ken Williams's user avatar
0 votes
1 answer
71 views

Group of unsolvable API and core errors

I really would appreciate any advice to dig deeper into the debugging of some errors. The reason may lay in our installation which is grown since late 2015 (I think it was version 4.2) and widely ...
nielo's user avatar
  • 1,304
3 votes
3 answers
108 views

How to see the SQL generated by Api4 calls?

When trying to express SQL joins with API4 I feel the need to check the SQL that's being created, as there's some 'magic' that might or might not be happening. It wasn't clear to me how to do this.
artfulrobot's user avatar
  • 3,930
3 votes
1 answer
137 views

Best (api4) way to chain save a contact so that the email updates, without creating a new one?

Using civicrm api4, what's the best way to chain save a contact so that the email updates, without creating a new one? For example, I want to update this existing contact: entity: Contact, action: get,...
MikeSteigerwald's user avatar
0 votes
1 answer
134 views

API V4 - Uncaught Exception: Authorization failed

With this code I created contact, but only when I'm authorized. civicrm_api4('Contact', 'create', [ 'values' => [ 'contact_type' => 'Individual', ...
Rustam's user avatar
  • 39
0 votes
2 answers
111 views

How to get Target Contacts from Api4 Activity.get call?

I have an Api4 call that gets a particular set of activities. I'd like the call to return the names of the "target"/"with" contacts. I've tried: Joining the Contact directly "...
artfulrobot's user avatar
  • 3,930
0 votes
1 answer
66 views

Searchkit Buttons not working

Using beta version of SearchKit. Buttons for Add, Compose Search and AND,OR,Not options are not working/unresponsive.
Dave T's user avatar
  • 1,239
3 votes
1 answer
73 views

api4: get(FALSE) vs get()->setCheckPermissions(FALSE): which is preferred?

In ap4, there are apparently two different ways to specify skipping permissions: In the api4 browser at /civicrm/api4, when you un-check the "CheckPermissions" checkbox, the action method is ...
TwoMice's user avatar
  • 1,814
1 vote
1 answer
47 views

Validating options in API4?

Is there a way to make APIv4 validate options when creating/updating? For example, using the demo data I can run: $ cv api4 Contact.update '{"where":[["id","=",202]],&...
Aidan's user avatar
  • 13.5k
0 votes
2 answers
155 views

Use complete address and full county name in mailings

Working on a mailing that includes contacts full address details. And I'm encountering an issue for UK addresses where the county is abbreviated in the same way US states are. I've never seen such 3-...
dmgeurts's user avatar
4 votes
1 answer
75 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 ...
Aidan's user avatar
  • 13.5k
0 votes
0 answers
59 views

apiv4 no longer sees custom fields that allow for multiple entry

I just noticed an error on a site I maintain. Some custom code uses apiv4 to return a value from a set of custom fields (on individual contacts) and that function now throws an error: API_Exception: ...
ericG's user avatar
  • 600