How can I get back a dump of the full param array when a chained api call fails, so that I can see what values are coming back from the previous call and going into the chained call (and thus better troubleshoot cause of failure)?

I know that I can add the "debug" param into the array, but I can't seem to read the trace in a way that tells me what $value was returned from the previous call and inserted to the chained call.

1 Answer 1


You can use try/catch and the CiviCRM_API3_Exception class to get more information. It would be something like this:

  $result = civicrm_api3('contact', 'get', $params);
catch (CiviCRM_API3_Exception $e) {
  // handle error here
  $errorMessage = $e->getMessage();
  $errorCode = $e->getErrorCode();
  $errorData = $e->getExtraParams();
  return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);

The getExtraParams method should give you what you are looking for.

  • 1
    That doesn't seem to be addressing question of a chained call, and getting the debug info from between the calls.
    – Joe Murray
    Commented Apr 10, 2015 at 0:31

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.