Skip to main content

Questions tagged [apiv4]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer
79 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.7k
3 votes
3 answers
122 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,952
3 votes
1 answer
91 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,856
3 votes
1 answer
137 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
3 votes
1 answer
164 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
2 votes
1 answer
30 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
  • 651
2 votes
1 answer
61 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
  • 513
2 votes
1 answer
33 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
2 votes
1 answer
75 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
2 votes
1 answer
55 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
2 votes
1 answer
37 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
2 votes
1 answer
135 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
  • 792
2 votes
0 answers
213 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
1 vote
1 answer
17 views

API 4 Explorer: Adding my custom action to existing Api4 Action from Civi

I am trying to add a custom API4 action to an existing Civi API4 action. Example: Email entity. Add new action to do some stuff. In Api3 it is possible. In API4, I am not sure how to do it if possible....
darkmode's user avatar
  • 135
1 vote
1 answer
79 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
1 vote
1 answer
85 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,186
1 vote
1 answer
26 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
  • 335
1 vote
1 answer
17 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,186
1 vote
1 answer
91 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
  • 103
1 vote
1 answer
344 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
  • 651
1 vote
1 answer
92 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
1 vote
1 answer
30 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
1 vote
2 answers
66 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
1 answer
82 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
1 vote
1 answer
28 views

How to get rid of obsolete APIv4 Extension from Extensions Admin Page?

How do I get rid of this from my extensions page? Not a big deal, just OCD is triggered by it.
themak's user avatar
  • 3,553
1 vote
1 answer
238 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
  • 121
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
1 vote
1 answer
57 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.7k
1 vote
0 answers
12 views

Get title/label in other languages using APIv4?

I have a multilingual installation of CiviCRM with en_US, nl_NL, and fr_FR enabled. The civi version is 5.58.1 Basically, I want to do select id, title_en_US, title_nl_NL, title_fr_FR from ...
AlainB's user avatar
  • 563
1 vote
0 answers
40 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
  • 827
1 vote
0 answers
19 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
0 answers
165 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
82 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
  • 23
0 votes
2 answers
56 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
0 votes
2 answers
127 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
0 votes
2 answers
243 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
  • 651
0 votes
2 answers
126 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,952
0 votes
1 answer
23 views

Use APIv4 to change Case Manager role and to add another role as well

Some of these API calls get complicated, and I am unable to figure out the following... I am able to create a new case using the APIv4 as follows (client contact_id=3175): $results = civicrm_api4('...
jsherk's user avatar
  • 651
0 votes
1 answer
57 views

CiviCRM Wordpress Critical Error Upon Event Registration

When registering for an event - I get the following fatal error: Registration is successful, email is sent. Thank You page is not displayed. CiviCRM 5.73.3 WordPress 6.5.4 Fatal error: Uncaught Error: ...
themak's user avatar
  • 3,553
0 votes
1 answer
37 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
0 votes
1 answer
69 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
0 votes
2 answers
161 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
0 votes
1 answer
81 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
  • 838
0 votes
2 answers
50 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
24 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
  • 896
0 votes
1 answer
34 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
0 votes
1 answer
119 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,302
0 votes
1 answer
91 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,354
0 votes
1 answer
188 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
0 answers
21 views

Is it possible to do field comparison filter in API4?

I'm working with API4 and am unclear the syntax for a where clause (or if the following is possible). What I'd like to do is compare two custom fields in a filter for a Contact Get request. So ...
lcdservices's user avatar