I have this problem on my Joomla 4.6.2 system, and can reproduce it on the Joomla sandbox. If I use the API Explorer to build a query like:

$result = civicrm_api3('Contribution', 'get', array(
  'sequential' => 1,
  'return' => "id",
  'contact_id' => 2,
  'financial_type_id' => "Campaign Contribution",

it works OK. But if I try to specify multiple possible values for financial_type_id, such as:

$result = civicrm_api3('Contribution', 'get', array(
  'sequential' => 1,
  'return' => "id",
  'contact_id' => 2,
  'financial_type_id' => array("Campaign Contribution", "Donation"),

it generates a SQL error because it creates an invalid WHERE clause:

WHERE  ( civicrm_contribution.is_test = 0 AND civicrm_contribution.financial_type_id 0 )  AND (contact_a.is_deleted = 0)  LIMIT 0, 25 

The "civicrm_contribution.financial_type_id 0" should instead be something like "civicrm_contribution.financial_type_id IN (1, 2)"

Is this a bug?

1 Answer 1


Instead of

'financial_type_id' => array("Campaign Contribution", "Donation")


'financial_type_id' => array('IN' => array("Campaign Contribution", "Donation"))

The API Explorer can generate this code for you if you select the IN operator.

  • Yeah, I think that works...but the new API Explorer version generates the incorrect code in my initial post (I don't think it did that on 4.6.0, though I could be wrong.) I'm waiting for 4.6.3 to fix the bug of Contribution get not using a specified contact ID as a filter, before continuing to troubleshoot the area where this is a problem for us.
    – Norris
    Commented May 18, 2015 at 0:34
  • 1
    I'm pretty sure the explorer will generate the above (correct) code if you select the "IN" operator. This is generally (but not always) the way to pass multiple values to a "get" operation. Some apis are not entirely consistent with this, hence the explorer's ability to generate code in either format.
    – Coleman
    Commented May 18, 2015 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.