Tag APIs
civicrm_tag_create(&$tag)
File: api/v2/Tag.php
Availability: v2.0
Returns array of Contact Id related to Tag ID. If array is empty, then all Contact ID returned in array.
Add a tag. Tags are used to classify CRM entities (including Contacts, Groups and Actions). Use crm_entity_tag_add to assign an entity to a tag.
Parameters:
- 'params' (array) Associative array of "property_name"=>"value" pairs to insert the Tag. Refer to the CRM Data Model for available properties.
- for updating Tag record pass tag id in array like $params['tag']
Returns:
civicrm_tag_delete(&$tag)
File: api/v2/Tag.php
Availability: v2.0
Deletes an existing Tag.
Parameters:
Returns:
- Null - if successfull, 'object of CRM_Core_Error' - otherwise.
 | Deleting a Tag
Deleting a Tag will result in deletion of all Tag_entity assignments for that tag. For example, any Individuals assigned to a deleted tag will no longer be tagged for that tag. |
civicrm_tag_get(&$tag)
File: api/v2/Tag.php
Availability: v2.0
Returns array of Details related to Tag ID / Name.
Parameters:
- 'params' (array) Associative array of "property_name"=>"value" pairs to get details of the Tag. Either of Id / Name is required to fetch the record.
Returns:
Tag Entity APIs
civicrm_entity_tag_get( &$params )
File: api/v2/EntityTag.php
Availability: v2.0
Returns array of Tag Id related to Contact ID.
civicrm_tag_entities_get( &$params )
File: api/v2/EntityTag.php
Availability: v2.0
Returns array of Contact Id related to Tag ID. If array is empty, then all Contact ID returned in array.
Returns:
- Array of Contact ID
- Null (if there are no applicable related contacts).
civicrm_entity_tag_common( &$params, $op = 'add' )
File: api/v2/EntityTag.php
Availability: v2.0
File: api/v2/EntityTag.php
Availability: v2.0
Assigns an entity (e.g. Individual, Organization, Group, Contact_action) to a Tag (i.e. 'tags' that entity).
Parameters:
An array including at least one Tag array and at least one Entity array.
Returns:
- An array with statistics.
File: api/v2/EntityTag.php
Availability: v2.0
Deletes an existing entity tag assignment.
Parameters:
- Array of Contact and Tag arrays.
( If want to Remove more than one tag of Contact: use tag_id_1, tag_id_2 where 1, 2 used for differentiate the tag key in array, for single tag remove use tag_id in array )
Returns:
- Array of statistics if successful, 'object of CRM_Core_Error' - otherwise.