Skip to main content
4 votes
Accepted

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

Yes, all strings will be escaped automatically by the CiviCRM code.
Pradeep Nayak's user avatar
3 votes
Accepted

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

There was a long discussion about this at https://lab.civicrm.org/dev/core/-/issues/3738 which resulted in a new $result->rekey() method added to the next beta (5.74). See https://github.com/...
Coleman's user avatar
  • 18.8k
3 votes
Accepted

Retrieving Contact information with API4 Inside the module

Try changing \Civi\Api4\Contact::get(TRUE) to \Civi\Api4\Contact::get(FALSE) The TRUE/FALSE parameter is a short-hand for checkPermissions. The default in Api4 is that permissions are checked but you ...
Aidan's user avatar
  • 13.5k
3 votes

Api get all option within sub entity

The best way to learn how to use the API is the Api Explorer which is built into CiviCRM (find it in the Support -> Developer menu. It will write the following code for you: $optionValues = \Civi\...
Pradeep Nayak's user avatar
3 votes

Creating extensions for custom tables

It sounds like what you are asking about are Custom Field Groups. A Custom Field Group is generally not accessible from the API as an entity. Instead, you access the Custom Fields within the Custom ...
Lars SG's user avatar
  • 4,083
3 votes
Accepted

Invalid field 'contact_id.is_deceased' Apiv4

That backtrace seems to point to this change as the culprit, however after several attempts I've been unable to reproduce that error. We can continue discussion on this issue: https://lab.civicrm.org/...
Coleman's user avatar
  • 18.8k
2 votes
Accepted

Get uploaded file full URL via API v4

With the help of Lars SG's links. I created a, PHP 8, helper function to get a URL based on a file ID provided by the API. function se_45209_get_entity_image_url( int $entity_id, int $file_id ): ...
Michael Bragg's user avatar
2 votes

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

Apply this patch Jeremy -> this is fixed in the D10 version of CiviCRM Entity, but the D9 version requires this backport by Pradeep: root@46c1218044c0:/var/www/drupal/web/sites/default/modules/...
KarinG - Semper IT's user avatar
2 votes

Get Phone or Email with API4 not possible?

This looks like a 2-parter so I'll just answer your first question about how to fetch all emails & phones for a contact. Please start a new post for your curl question. APIv4 does fetch all fields ...
Coleman's user avatar
  • 18.8k
2 votes

CiviCRM Wordpress Critical Error Upon Event Registration

It sounds like you don't have civicontribute enabled.
Demerit's user avatar
  • 23.3k
2 votes
Accepted

Use Order API or use APIv4?

The advice to use Order API is still sound and should be followed. As of this post it has not yet been ported to APIv4 so you'll have to use v3 until that work is complete. Progress on the port can be ...
Coleman's user avatar
  • 18.8k
1 vote
Accepted

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

I have finally tracked it down to an API call that I used to get the values of a particular option group. The code was: $optionValues = \Civi\Api4\OptionValue::get() ->addWhere('option_group_id:...
ChumKui's user avatar
  • 786
1 vote

Can we get distinct by using API4?

Depending what you're trying to do you might be able to just use group by, like if you want a list of all the distinct last names in your database: \Civi\Api4\Contact::get() ->addSelect('...
Demerit's user avatar
  • 23.3k
1 vote
Accepted

Can't store is_confirmation_enabled via API

As humiliating as it is, I want to post an answer to keep the suggestions in the comments and to perhaps give someone a hint who may make a similar mistake to mine. I had another line of code later in ...
MtnPavlas's user avatar
  • 856
1 vote

Get uploaded file full URL via API v4

Short answer: Use the Attachments API instead, but it isn't available in API 4 yet, so you'll have to use API 3. See this previous question for discussion.
Lars SG's user avatar
  • 4,083
1 vote

API4 GroupContact does not update Subscription History?

APIv4's GroupContact was updated circa 5.49 to auto-update the SubscriptionHistory (https://github.com/civicrm/civicrm-core/pull/22419 - contemporaneously with the question here).
Tim Otten's user avatar
  • 5,684

Only top scored, non community-wiki answers of a minimum length are eligible