This documentation relates to CiviCRM version 3.2. It's not maintained anymore.
Current version of documentation.

Group APIs

Skip to end of metadata
Go to start of metadata

This page refers to outdated version of CiviCRM. Check current version of documentation.


Documentation Search


CiviCRM 3.2 Documentation

Support and Participation

Developer Resources


CiviCRM book!

Make sure to check out Understanding CiviCRM as well! You can also support this project by ordering a hard copy.

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.
    Create group
    Result

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
    Get Group
    Result

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.
    Delete Group
    Result

Group Contact APIs

civicrm_group_contact_add( &$params )

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.
    Add Group Contacts
    Result

civicrm_group_contact_get( &$params )

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.
    Get Group Contact
    Result

civicrm_group_contact_remove( &$params )

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.
    Remove group contacts
    Result
Labels
  • None

Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.