Posted: March 19, 2018 at 2:51 pm
|
I’m a beginner developer, and I’m developing a mobile app in which subscribing users can view the events in which they sign up and download their tickets through the app. My Settings: Awaiting response. |
Hi there, One thing to check is make sure you have a valid attendee ID. You can go to Event Espresso > Registrations > Contact List, then check what’s listed there to see if there’s an ID that matches the attendee ID. The other thing to check is whether the request was authenticated. Other routes like |
|
|
Hello Josh, I checked and there is yes a participant with a valid ID listed. Which I can edit and view that has a wordpress user profile linked to the participant. But when I try to access it by request, filtering by the user (which is the first information I can get), no participant is returned, only an empty list. And it’s not a permission issue, since I use the “JWT Authentication for WP-API” plugin for authentication, passing the user token in the request header. I know some information is public and some is not. You see, I have an application in which a non-admin user needs to view their enrollments. So for this, I had to enable viewing permissions for non-admin users with the “Members” plugin. But the question is that when searching for ‘/wp-json/ee/v4.8.36/attendees’, the answer brings me all the participants, being that I want only the participant linked to the logged in user. I also noticed that when you filter by ‘/wp-json/ee/v4.8.36/attendees?where [WP_User.ID] = {admin_ID}’, all participants are returned in response. And when I filter by ‘/wp-json/ee/v4.8.36/attendees?where [WP_User.ID] = {ID_of_my_user}’, it always returns an empty list. That is, all participants are bound by default to the admin user. Is this normal operation? |
Let’s step back a bit because you don’t actually get events or registrations from a request to The route that lists registrations is: If you only have the User ID, to get a list of registrations for the user, you’ll have to do two API endpoint queries: Another step back: WordPress does not expose meta to the REST API by default, so you’ll need to add a little function like this to your site’s functions plugin to expose the user meta field for Event Espresso’s Attendee ID:
Once that’s ready, your first query will go like this:
which will include the
|
|
|
Perfect. Exactly what I needed. |
The support post ‘How to get events to which the logged in user is subscribed to by the Rest API’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.