Support » Fixing WordPress » REST Api in WP 4.7

  • I found in the WP 4.7 documentation that the REST API interface now is a built-in WP features (https://developer.wordpress.org/rest-api/). I’ve installed a fresh WP 4.7 instance, it work well for all my needs but I can’t access the documented REST API endpoint http://mysite.com/wp-jons/.
    I get always the not found message in my browser when I try to access it:

    The requested URL /wp-json/ was not found on this server.

    I omit something to have REST API working? It necessary to do (enable/change configs) something before to use WP REST?

    Thanks in advance for any suggestions. Giovanni

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @gioma68.

    The correct URL is http://oursite.com/wp-json/ (and not “jons”).

    Hi @rahmohn thanks for your response, but clearly I used the right url /wp-json/, in my post I typed a wrong url…

    You need to be using pretty permalinks to access /wp-json/. If you’re not, you can instead use ?rest_route=/ to get the index and ?rest_route=/wp/v2/posts (e.g.) for specific routes.

    I also have a problem with getting JSON response. Few sites I tested it on use pretty permalinks but only 404 or some archives are displayed. I tried ?rest_route=/ as well but without success.

    Is anybody aware of any possible conflicts with plugins? Or what in general could be wrong?

    @rmccue
    I couldn’t find any official documents mentioned about the url you provided ?rest_route=/wp/v2/posts but this url works well in wordpress 4.7 and 4.8 just after first installed.
    I tired the url mentioned on official wordpress document such as /wp-json/wp/v2/settings or /wp-json, it works on its demo site but not mine.

    I’m wandering where did you find this kind of querystring url and where I can get the document?

    • This reply was modified 3 years, 4 months ago by jasonhsieh.

    This solution worked for me too. Why use that disturbingly looking string instead of the normal (publicized) link we all saw in tutorials, articles and the official documentation and came to love?

    I think at least some deprecation text should be posted somewhere!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘REST Api in WP 4.7’ is closed to new replies.