Hot answers tagged

4

The CiviMobile API extension was developed specifically for the CiviMobile App. It's not a generic end point for other apps to use. If you were planning on using it in this way, then at the very least it would be wise to reach out to those developers to let them know that this is what you were doing, so they might re-consider implementing breaking changes. ...


3

From api explorer the results are retrieved using rest api where check_permissions is always set to TRUE by default even though its been explicitly set via api params. If you have check_permissions set to TRUE than api returns only those fields which are defined for the the entity. In your case the fields would be civicrm_api('Contribution', 'getfields', ['...


3

Certain field values are blocked through ajax call that includes from api explorer as well. The ajax call makes check permission to true by default and cannot be over-riden from api params. The result may vary incase calling from php or smarty


3

The function user_load is deprecated in D9. https://api.drupal.org/api/drupal/core%21modules%21user%21user.module/function/user_load/8.7.x Looks like we need a replacement stub function in the drupal module. For a quick hack, you could append this to /var/www/drupal/web/modules/contrib/civicrm/civicrm.module (or wherever it lives on your server). A better ...


2

I just installed a CiviCRM and Drupal 9 instance (5.40.1). These were my steps: I enabled the new authx extension cv ext:enable authx I allowed the authenticate with the api_key in a special header cv ev 'Civi::settings()->set("authx_xheader_cred",["api_key"]);' The auth extension does not have a configuration screen, yet. I added ...


2

The correct endpoint for WordPress is wp-json/civicrm/v3/rest. Its documented in the developer manual, see https://docs.civicrm.org/dev/en/latest/api/v3/wp-rest/#endpoints. When you just copy the URL that is suggested in the API explorer you are left in the dark.


2

Updated! based on Coleman's answer, and additional testing. First of all, for WordReplacement, if you want to update a single record it's best and most appropriate to use the get action to get the record ID (civicrm_word_replacement.id). Then (as Coleman noted) use the create action and include the id parameter to update just that record. (Without the id ...


2

If include 'state_province' in return param it should return you state_province_id, state_province_name and state_province. For geofield1 you need to use 'geo_code_1'. If you search for primary address in return field drop down under api explorer you should see the exact name for fields to retrieve for address. $result = civicrm_api3('Contact', 'get', [ '...


2

API CSV Import extension uses Job Scheduler to import the records in Civi. The job scheduler breaks down the whole csv into small batches(also known as queue item) to import to avoid timeout issue, memory excess and various reasons. 'Number of Items' is used to define how many records you want to process in single single queue. If you specify 2000 than there ...


2

the correct syntax is the one at the top: "first_name": {"LIKE":"hei%"} to work around the encoding issues (that might be tricky indeed), don't try to put all the params in the url (as http get) but use a http post (the api works with both)


2

You can do multiple not like statements using api4


2

For your cv call either turn off the permission check or specify a user to run with. So either: <?php $result = civicrm_api4('Contact', 'get', [ 'checkPermissions' => FALSE, 'select' => ['id'], 'where' => [['first_name', '=', 'Ken']], 'limit' => 2, ]); echo $result->count(), "\n"; or ...


2

If you are happy working with the command line, install cv then you can run cv scr /path/to/your/script.php To use your script with cv add <?php as the first line. You'll want 'select' => ['id'], not 'select' => ['primary_contact_id'], Once you get that far, you could just create the contributions directly instead of outputting the id and doing a ...


2

It's not an "api" exactly, but you can use: $caseParams = [ 'activity_id' => 1234, 'case_id' => 12, ]; CRM_Case_BAO_Case::processCaseActivity($caseParams); Are you saying the api call used to work before and now is failing? I'm not sure if it ever worked before with an existing activity? It looks also like ...


2

the API key sits in the database as a field for the CiviCRM contact. You can find it in the table civicrm_contact. If you are not too technical and do not access your database directly on a regular basis the is an extension you can use called API Key (https://civicrm.org/extensions/api-key) which will show an additional tab for contacts if you are a sysadmin ...


1

I can't help on the csvimporter part as I am not using it but the CustomField entity is used for defining custom fields. It could be used if you want to create new custom fields from a csv file so it's not what you are looking for. Instead, you should use the Contact entity which should have the custom fields you need. If csvimporter doesn't work, you might ...


1

You may need to add below line in .htaccess or nginx config to allow php file be executed RewriteCond %{REQUEST_URI} !/libraries/civicrm/extern/[a-z]+\.php$ Copy extern directory from civicrm vendor folder into libraries The rest api url for drupal would look like https://sitename/libraries/civicrm/core/extern/rest.php


1

I think there may be some misunderstanding about the purpose of the replace action. To clarify, this is a specialized api action intended to perform a simultaneous create/update/delete on a bunch of records. It's typical use would be to replace all of a contact's email addresses with a new set of email addresses. Perhaps the confusion arose from similarity ...


1

You can't create a csv directly from an API call. But it would be a very simple task to make an API call and then format the results as a csv. One simple option might be to use Google Apps Script to call the API then put the results into a spreadsheet, if you don't want to run this as a standalone script. Or any scripting language you might want to use will ...


1

You'll have an easier time modifying the permissions from within CiviCRM - Administer menu >> Users and Permissions >> Permissions (Access Control). When changing permissions from WP, you're usually dealing with machine names, not human-readable labels, so it can be hard to correlate error messages with the particular permission needed. It ...


1

CSV Import and Form Processor IS a powerful combo! Check out the advimportformprocessor extension. Note that this combines the "advimport" extension rather than the CSV API GUI extension with Form Processor. It's overall better, but some work on advimport's rough edges would improve the UX. Also note that Form Processor is pretty slow, so imports ...


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