• Hello all!

    I am playing around with the WordPress REST Api and I encountered a problem I couldn’t solve so far:

    I am trying to retrieve all comments for a specific post. The endpoint for that is /wp-json/wp/v2/comments?post=1234. When trying this API call in Postman it is working just fine. I put my credentials in as Basic Auth and I’ll get an array of comments as the response.

    When I am using this exact same API call on my actual site (I am developing on my local machine, so localhost) I’ll get an empty array. It is a successful request returning a 200 status. When checking the headers the authorization is sent correctly.

    I tried many different ways to make the API call: jQuery ajax, XMLHttpRequest, etc.. all variants returned an empty array while being a successful call.

    What might be the problem here..?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dukan90

    (@dukan90)

    I found out that the problem is connected to a certain plugin that I am using:

    https://github.com/GM-Alex/user-access-manager

    This plugin restricts content from being accessed by unauthorized users by implementing a “group”-system.

    Somehow this plugin prevents the REST API from working properly. Maybe someone can help me with what I should look for when trying to find the source of the problem.

    I have to use this plugin on my site, so unfortunately deactivating this plugin is not an option..

    Moderator bcworkz

    (@bcworkz)

    You can try asking the author through the support forum for advice. Unfortunately, support there seems to be weak, but another user familiar with the plugin could possibly help.

    Generally speaking, plugins should alter how the API works through filters and action hooks. Most, if not all of the API hooks are prefixed with “rest_”. You can try searching through the plugin source code for any additions to such named hooks. The ‘nix command grep or similar search utilities can be very useful in finding such code.

    Thread Starter dukan90

    (@dukan90)

    Alright I will try that, thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP REST call works in postman but not on actual site’ is closed to new replies.