Support

Home Forums Event Espresso Premium What is a endpoint for 'espresso_events' comments API ?

What is a endpoint for 'espresso_events' comments API ?

Posted: August 1, 2019 at 10:39 pm

Viewing 1 reply thread


theplannerwire

August 1, 2019 at 10:39 pm

In my project i need to use a ‘espresso_events’ comments also, so as per the WordPress documentation for comments API i am using an endpoint like this
“/wp/wp-json/wp/v2/comments?espresso_events=704” ; so according to this it should display only 704 post-ids comments. But in my case it returns me all the comments which are posted in the post also. See below JSON result of the above API endpoint. https://nimb.ws/W19xhv


Tony

  • Support Staff

August 2, 2019 at 4:16 am

Hi there,

The above is incorrect and the reason you’re getting all comments on that output is that ?espresso_events=704 is invalid and being ignored.

A custom post type is still a post, so to pull the comments for an EE event with ID 704 you would use:

/wp/wp-json/wp/v2/comments?post=704

However, right now that’s going to return an error such as:

{"code":"rest_cannot_read_post","message":"Sorry, you are not allowed to read the post for this comment.","data":{"status":401}}

That’s because the Espresso Events events are not set to show in rest as we have our own endpoints, it’s filterable so you can enable the above but I’m checking with our developers to confirm there’s nothing I’m missing on our endpoints to allow for this.

Viewing 1 reply thread

The support post ‘What is a endpoint for 'espresso_events' comments 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.

Event Espresso