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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Comparisons in the API
Pages: [1]

Author Topic: Comparisons in the API  (Read 433 times)

man4mac

  • I’m new here
  • *
  • Posts: 9
  • Karma: 1
  • CiviCRM version: 4.1
  • CMS version: Druapl 7
  • MySQL version: 5.5
  • PHP version: 5+
Comparisons in the API
October 03, 2012, 09:36:03 am
I'm unsure of how to perform a very simple request in the API, but I can't find any documentation on it. Lets say I want to get all contacts with an ID > 10. Seems simple. Here have been my attempts:

Code: [Select]
<?php
$params = array(
"version" => 3,
"id >" => "10"
);
print_r(civicrm_api("Contacts","get", $params));
?>


Code: [Select]
<?php
$params = array(
"version" => 3,
"contact_id >" => "10"
);
print_r(civicrm_api("Contacts","get", $params));
?>

Code: [Select]
<?php
$params = array(
"version" => 3,
"contact_id" => array(">",10)
);
print_r(civicrm_api("Contacts","get", $params));
?>

Code: [Select]
<?php
$params = array(
"version" => 3,
"contact_id" => "> 10"
);
print_r(civicrm_api("Contacts","get", $params));
?>


Any help would be appreciated

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Comparisons in the API
October 05, 2012, 02:07:35 am
You can find documentation and examples in the developer guide : http://book.civicrm.org/developer/current/techniques/api/
There are also examples of API usage in the folder <your civicrm site>/civicrm/api/v3/examples
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Comparisons in the API
October 07, 2012, 06:00:27 pm
The entity is 'contact' not 'contacts' ('Contact' is also OK - but drop the 's')
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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Comparisons in the API

This forum was archived on 2017-11-26.