2

I am trying to use api3 to get all participants to an event of a certain type. In SQL I would use an inner join for this, using api chaining I do:

  $result = civicrm_api3('Participant', 'get', array(
  'sequential' => 1,
  'api.Event.get' => array('event_type_id' => $type_id),
));

However this results in all event participants, to every type of event, being returned. The ones who haven't participated in an event of the type get no events tacked to them. Is there a way in the API to filter these participants out?

  • Are you trying to get all participants of 1 event, or all participants for any event of a certain type? – ErikH - CiviCooP Jul 27 '17 at 14:15
  • all participants for events of a certain type – joost Jul 27 '17 at 14:16
1

Normally you could handle this with an API Join rather than an API Chain but unfortunately the Participant API is one of the four quirky entities that don't support this.

APIv4 is under heavy development right now, and one of the primary goals is to standardize these four entities to eliminate this limitation of APIv3. You may want to test APIv4 to see if it meets your needs yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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