• edo78

    (@edo78)


    Hi, wordpress newbie here. Not even 100% sure this is the right place for my question but there are so many support channels that I’m a bit lost.

    I have a self-hosted instance of wordpress and I’m having an issue with a specific endpoint.

    I’ve done some test and calling GET /wp/v2/posts is working as intended returning public posts (eg. only published posts and no drafts) but GET /wp/v2/posts return a 401 error with code rest_forbidden

    Am I missing something? I’d expect the settings should be public (I’m trying to get the title, description and url of the site) but wordpress doesn’t want to show them to me …

    • This topic was modified 3 years ago by t-p. Reason: Moved to Fixing WordPress from Everything else WordPress

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve done some test and calling GET /wp/v2/posts is working as intended returning public posts (eg. only published posts and no drafts) but GET /wp/v2/posts return a 401 error with code rest_forbidden

    Hi, I believe your concern is you’re getting 401 error in the /wp/v2/settings endpoint? You’ve mentioned the same endpoint in your post.

    If you really mean wp/v2/settings endpoint, you need to implement authentication to access it. Some endpoints require an authentication for security purposes. Basically, you need to add a cookie and nonce to do that. See this documentation for the details. https://developer.www.ads-software.com/rest-api/using-the-rest-api/authentication/#cookie-authentication

    Thread Starter edo78

    (@edo78)

    Sorry I made a “copy&paste” error. My problem is with the settings endpoint.

    Is there any endpoint that doesn’t require authentication to return title, description and url of a site?

    Those are all public info and I struggle to find a way to obtain them without struggling with an auth mechanism.

    BTW thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘API unexpected behaviour’ is closed to new replies.