CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • options for group_contact_get
Pages: [1]

Author Topic: options for group_contact_get  (Read 614 times)

pike67

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 0
  • CMS version: drupal7
options for group_contact_get
August 31, 2012, 05:54:27 am
Hi

On Civi 4.1.1, apiv3, trying to get contacts from a group, i get memory issues.

Code: [Select]
$params = array(
'group_id' => $gid,
'option.limit' => 100,
'version' => 3,
'api.contact.get' => 1      // this makes it return the contact data
);
$results = civicrm_api( 'group_contact','get',$params );

I could already weed out most of the contacts by looking for a particular type (individual,organisation). but how would I do that ?

The best documentation I found sofar is
http://api.civicrm.org/v3/CiviCRM_APIv3/API_Group/_api---v3---GroupContact.php.html
which says "* return: list of groups, given contact subsribed to" :-D
api.contact.get is not described anywhere.

I could also loop through contacts instead - would that help ?
In apiv2, you could do a search on group - is that gone in api v3 ?


thanks,
*-pike





xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: options for group_contact_get
August 31, 2012, 06:34:14 am
So you want to fetch the individual contacts that belong to group x?

Code: [Select]
$params = array(
'group' =>  $gid,
        'contact_type' => 'Individual',
'option.limit' => 100,
'version' => 3,
'return' => 'first_name,last_name,whatever'      // this makes it return the contact data
);
$results = civicrm_api( 'contact','get',$params );

Try using the api explorer to check with different params (eg for the return)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

pike67

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 0
  • CMS version: drupal7
Re: options for group_contact_get
August 31, 2012, 07:34:24 am
Quote from: xavier on August 31, 2012, 06:34:14 am
So you want to fetch the individual contacts that belong to group x?

Yes! Excellent! Performs MUCH better.

Except, option.limit doesnt seem to work here. The api explorer seems to suggest that is the right syntax, but then igmores it. Always the first 25.

Ah, it's 'rowCount' - case sensitive too.

thanks!
*-pike
« Last Edit: August 31, 2012, 07:41:34 am by pike67 »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • options for group_contact_get

This forum was archived on 2017-11-26.