Group APIs
civicrm_group_add( $params )
Availability: v2.0
This API creates a new group or updates an existing group.
If params array contain group id, then API will update corresponding group else API will create new group
Either group id or group title is required field
Parameters:
- 'params' (array) Associative array of property name/value pairs to insert in new 'group'.
Returns:
- On success, API returns array containing group id as result.
- On failure, API returns array containing error message.
civicrm_group_get( $params )
Availability: v2.0
Modified: v2.1 (function name changed to civicrm_group_get from civicrm_groups_get)
Returns array of groups matching a set of one or more group properties passed in $params array name-value pair.
Standard wildcard characters (% and *) may be used in within the values. All select criteria are AND'd together.
If value passed for $params is set as null, all existing groups will be returned.
Parameters:
- 'params' (array) Array of one or more valid property_name=>value pairs. Limits the set of groups returned.
Valid property names include: id, title, name.
Returns:
- An array of groups.
 | Getting Group
|
civicrm_group_delete( $group )
Availability: v2.0
Delete an existing group.
 | Deleting a Group
This API also removes any existing group membership (Group_contact) entries. |
Parameters:
- 'group' (array) Associative array of property name/value pairs contains group id
as ( 'id' => $groupID );
Returns:
- On success, API returns array containing result set to 1.
- On failure, API returns array containing error message.
Availability: v2.0
Add a contact to an existing group.
Parameters:
- 'params' (array) Associative array of property name/value pairs contains group_id and contact_id
as ( 'group_id' => $groupID, 'contact_id' => $contactID );
Returns:
- On success, API returns array containing total count of contact, count of added contact, count of not added contact.
Availability: v2.0
Returns the array of groups for contact based on status of membership.
Parameters:
- 'params' (array) Associative array of property name/value pairs it should contain contact_id
as ( 'contact_id' => $contactID );
Returns:
- Array (reference ) the relevant data (name/values pair) for the contact contain group information to given contact.
Availability: v2.0
Remove contact from an existing group.
Parameters:
- 'params' (array) Associative array of property name/value pairs contains group_id and contact_id
as ( 'group_id' => $groupID, 'contact_id' => $contactID );
Returns:
- On success, API returns array containing total count of contact, count of removed contact, count of not removed contact.