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) »
  • Using API to retrieve Contact records by modified_date?
Pages: [1]

Author Topic: Using API to retrieve Contact records by modified_date?  (Read 1508 times)

nicolas

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 6
    • cividesk
  • CiviCRM version: 4.4 LTS
  • CMS version: Standalone (yep)
  • MySQL version: 5.1
  • PHP version: 5.3
Using API to retrieve Contact records by modified_date?
December 13, 2011, 08:33:24 pm
I need to retrieve the list of contacts modified since a certain date, or a list of contacts ordered by modified_date desc. Is there a simple way to do that with the API v3 (guess: api chaining with the log table and modified_date_low attribute)? If not, is it easy to add (point me in the right direction and I will do it)? If neither of the above, is that type of request built into the Contact BAO/DAO? If none of these works, I will hack a SQL query together ...

Thanks.
cividesk -- CiviCRM delivered ... your way!

nicolas

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 6
    • cividesk
  • CiviCRM version: 4.4 LTS
  • CMS version: Standalone (yep)
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Using API to retrieve Contact records by modified_date?
December 15, 2011, 11:01:34 am
Bump.
Anybody can put me on the right path to add this feature to the APIs v3?
cividesk -- CiviCRM delivered ... your way!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Using API to retrieve Contact records by modified_date?
December 15, 2011, 01:11:22 pm
Hi,

Join us starting in about 12 hours for the code sprint on irc, we'll be able to help you

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Using API to retrieve Contact records by modified_date?
December 15, 2011, 03:06:08 pm
I do believe that the contact api query does a join on the log table - pretty sure you can filter on modified_date_high - not sure about sort but do just try in case.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

nicolas

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 6
    • cividesk
  • CiviCRM version: 4.4 LTS
  • CMS version: Standalone (yep)
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Using API to retrieve Contact records by modified_date?
December 22, 2011, 09:52:09 pm
If only there was an explanation, anywhere, on how to use the APIs ... I have no idea how to do the 'filter' you are talking about. I know there are also options to query only certain fields, or to do multiple queries in a single call, paginate and probably many more things, but I could not find any usable documentation on these APIs. (ex: http://wiki.civicrm.org/confluence/display/CRMDOC40/CiviCRM+Public+APIs does not give any concrete syntax, guidance or usage examples)

If anyone knowledgeable would give me 30 mins of their time on the phone or via email I am volunteering to write an in-depth API usage documentation for the community. Serious.

PS: I tried
    $params = array(
      'version' => 3,
      'return'  => 'display_name',
      'filters' => array(
          'modified_date_low' => '20111101',
          ),
    );
    $result = civicrm_api( 'Contact', 'get', $params);
And 1) I have many more fields than just 'display name' returned and 2) the filter does not seem to work at all as changing the date to anything else returns the same results.
cividesk -- CiviCRM delivered ... your way!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Using API to retrieve Contact records by modified_date?
December 22, 2011, 11:00:19 pm
Hi - send me a pm & we'll line something up. It might make sense to do it on IRC with the API team in attendance.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Using API to retrieve Contact records by modified_date?

This forum was archived on 2017-11-26.