Skip to content
Snippets Groups Projects
Unverified Commit b537d2a3 authored by homotechsual's avatar homotechsual Committed by GitHub
Browse files

Merge pull request #692 from seamuslee001/apiv4_documentation

Add in APIv4 Actions documentation
parents 2e493263 5f2c6262
No related branches found
No related tags found
No related merge requests found
# API Actions
# APIv3 Actions
Most entities support the following actions:
......
# APIv4 Actions
Most entities support the following actions:
## Create
Insert new records into the database.
## Update
Update records in the database.
## Delete
Delete one or more records. Requires an explicit `id`. If you want to skip the 'recycle bin' for entities that support undelete (e.g. contacts) you should set `$param['skip_undelete'] => 1);`
## Get
Search for records
## GetFields
Fetch entity metadata, i.e. the list of fields supported by the entity. There is now an option that you can pass in for get fields which is `loadOptions`. This is the equivilant of the apiv3 getoptions API call. When used for any field that specifies a pseudoconstant it will return the relevant options in an options key. You can also pass in an option `IncludeCustom` which will specifiy whether to include the relevant custom fields for that entity or not.
## Replace
Replace an old set of records with a new or modified set of records. (For example, replace the set of "Phone" numbers with a different set of "Phone" numbers.).
!!! warning
Replace includes an implicit delete action - use with care & test well before using in production.
## Save
Create or update one or more records
......@@ -11,6 +11,9 @@ Canonically, an API call is processed by the API kernel. The `$entity`, `$actio
A couple of significant differences between APIv4 and APIv3 is that in v4 the `check_permissions` flag is set to true by default and on get actions especially but more generally the limit of 25 items returned that v3 has has been removed in favour of coders specifying the limit if they want to in their code calls.
!!! info
As of CiviCRM version 5,18 not all core entities have been added to APIv4. You should check the API explorer to see which entities are available. If the entity you require is not available then please open a pull request against the [`civicrm-core` repository](https://github.com/civicrm/civicrm-core) to add the entity in or open an (issue)[https://lab.civicrm.org/dev/core] and request that the entity is added.
```php
$result = Civi::service('civi_api_kernel')->run('Contact', 'get', [
'version' => 4,
......
......@@ -50,7 +50,7 @@ pages:
- API Interfaces: api/interfaces.md
- APIv4:
- APIv4 Usage: api/v4/usage.md
# - APIv4 Actions: api/v4/actions.md
- APIv4 Actions: api/v4/actions.md
# - APIv4 Options: api/v4/options.md
# - APIv4 Joins: api/v4/joins.md
# - APIv4 Chaining: api/v4/chaining.md
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment