Questions tagged [apiv4]
The apiv4 tag has no usage guidance.
55 questions
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.
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()
->...
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('...
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....
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 ...
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: ...
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 ...
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', [
'...
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 ...
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-...
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
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 ...
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 ...
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],
[...
0
votes
0
answers
34
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 ...
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:
...
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 ...
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 ...
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 ...
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
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 ...
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 ...
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
...
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 ...
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 ...
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('...
0
votes
0
answers
75
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', '...
0
votes
0
answers
28
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 ...
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 ...
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 ...
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.
...
0
votes
0
answers
53
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 ...
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 ...
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'],
['...
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/...
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 ...
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 ...
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 ...
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.
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 ...
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 -> ...
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 ...
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/ ?
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 ...
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.
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 ...
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,...
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 "...
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',
...
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.