3

I'm trying to get participant info via CiviCRM API like this:

civicrm_api('Participant', 'get', 
   array(
      'version' => 3,
      'sequential' => 1,
      'contact_id' => $contact_id,
      'event_id' => $event_id
   )
);

but get the following error:

API permission check failed for Event/get call; insufficient permission: require access CiviCRM and access CiviEvent and view event info

I need to allow unauthorized users to access CiviCRM ("Master control for access to the main CiviCRM backend and API") and CiviEvent ("Create events, view all events, and view participant records (for visible contacts)") to solve this. Aren't those permissions to extensive, just to get some info about a participant? Or am I doing something wrong?

I'm using CiviCRM 4.7.23. I did not get this error in 4.7.14.

EDIT: I do not have to set these permissons to create a participant via API (which is OK). So I think there is definitely something wrong here.

1 Answer 1

2

I'm not sure what context you are doing this in, but since you are calling the API from php, you can pass in the param 'check_permissions' => FALSE to bypass the ACLs for the logged in user. This is useful when you know you want to get something from the api that the logged in user wouldn't normally be able to access. Just be careful!

1
  • Setting check_permissions to FALSE does not work. I'm still getting error "API permission check failed for Event/get call; insufficient permission: require access CiviCRM and access CiviEvent and view event info" as guest. Commented Aug 22, 2017 at 15:01

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.