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) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Getting smart groups with API call
Pages: [1]

Author Topic: Getting smart groups with API call  (Read 1291 times)

trevorwood

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 4
  • CiviCRM version: 4.0.2
  • CMS version: Joomla 1.6
  • MySQL version: 5.0.51a
  • PHP version: 5.2.6-1+lenny8
Getting smart groups with API call
January 10, 2012, 01:02:17 am
How do I get all the contacts in a smart group using the API

the group_contact, get API only seems to bring back normal groups.

Alternatively how would I retrieve all organizations that belong to group a and have a specified tag set?

at the moment I'm retrieving every contact in group a (organization & individual) then for the organizations only, retrieving the tag if it exists

Cheers

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Getting smart groups with API call
January 10, 2012, 01:19:00 am
you can retrieve all the org with a tag & group using the api.contact.get

try with the api explorer on your db, but something

/civicrm/ajax/rest?json=1&debug=on&entity=Contact&action=get&sequential=1&return=display_name,email,phone&contact_type=Organization&group=42&tag=123 should work

(if not try a combination of tag_id & group_id and it should)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

trevorwood

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 4
  • CiviCRM version: 4.0.2
  • CMS version: Joomla 1.6
  • MySQL version: 5.0.51a
  • PHP version: 5.2.6-1+lenny8
Re: Getting smart groups with API call
January 10, 2012, 03:39:50 am
I don't appear to have the api explorer on my system. At least i can't find any directories called ajax. This is a joomla installation

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Getting smart groups with API call
January 10, 2012, 07:18:47 am
Quote from: trevorwood on January 10, 2012, 03:39:50 am
I don't appear to have the api explorer on my system. At least i can't find any directories called ajax. This is a joomla installation

You should have (and that's sure you have a ajax something somewhere, that's used by quite a few functions)
might be (I don't know how to login to test):
http://joomla.demo.civicrm.org/index.php?option=com_civicrm&task=civicrm/api/doc
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Getting smart groups with API call

This forum was archived on 2017-11-26.