Questions tagged [apiv4]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
67 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
41 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
30 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
22 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
  • 826
2 votes
1 answer
32 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
  • 463
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
37 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
13 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
56 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
  • 1,839
0 votes
2 answers
46 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
0 answers
13 views

Joining Contact to Membership

Can someone let me know how to join Contact to Membership in ApIAPI v4, since membership is not under Entity? bit I can find that in API v3. Thanks
Learn CiviCRM's user avatar
2 votes
1 answer
22 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
40 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
  • 1,839
0 votes
0 answers
22 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
  • 521
0 votes
0 answers
15 views

Optimizing chained queries from the same api entity

I built a query to collect all the events from the current date to the end of the year with chained queries to collect the number of registered participants (so I can check if the event is full) and ...
Paul Dufresne's user avatar
0 votes
1 answer
20 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
71 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
  • 733
1 vote
1 answer
22 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
50 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
39 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
101 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
13 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
  • 1,839
1 vote
2 answers
51 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
112 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
26 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
167 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
27 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
  • 51
0 votes
1 answer
91 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,278
1 vote
1 answer
64 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
220 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
  • 521
0 votes
2 answers
124 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
  • 521
1 vote
1 answer
22 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
0 answers
22 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
59 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
58 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,294
3 votes
3 answers
103 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,910
3 votes
1 answer
106 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
104 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
93 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,910
0 votes
1 answer
61 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,229
3 votes
1 answer
62 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,794
1 vote
1 answer
44 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
  • 12.9k
0 votes
2 answers
153 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
72 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
  • 12.9k
0 votes
0 answers
57 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