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) »
  • API Case Entity and Get Action can not be called without search fields
Pages: [1]

Author Topic: API Case Entity and Get Action can not be called without search fields  (Read 1337 times)

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
API Case Entity and Get Action can not be called without search fields
July 08, 2013, 05:28:11 am
In most API's the Get action can be used to get all of them (contacts, activities etc.). This can not be done for the Case API, if you call it like this:
Code: [Select]
$apiCases = civicrm_api( 'Case', 'Get', array('version'=>3 ));

an error message is returned:
Code: [Select]
{
"is_error":1,
"error_message":"Missing required parameter. Must provide case_id, client_id, activity_id, or contact_id."
}

From a consistency point of view I would say it should return all cases. Points of view before I update the core versions?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API Case Entity and Get Action can not be called without search fields
July 08, 2013, 08:58:32 am
Yeap, using basic get should solve that (at least if no xxx_id set). Not sure what the custom code returns, but if not different from basic get, should simplify and use only the basic

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

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: API Case Entity and Get Action can not be called without search fields
July 08, 2013, 09:09:07 am
Case api is a bit more robust than what the basic get would return (since it allows you to search across 3 tables - not just case but also case_activity and case_contact).
But I agree that removing the requirement for search criteria is a good change.
Try asking your question on the new CiviCRM help site.

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: API Case Entity and Get Action can not be called without search fields
July 09, 2013, 02:14:44 am
Yep, Case API is indeed a little more robust and involved. But I will raise an issue to remove check on mandatory and fix it.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • API Case Entity and Get Action can not be called without search fields

This forum was archived on 2017-11-26.