Support » Fixing WordPress » Where is wp-json?

  • On a fresh install of WordPress 5.2.4 (which I’ve tried twice), whenever I try to create a new page I get a ‘Publishing failed’ error and the following in the logs

    2019/10/22 11:44:36 [error] 21135#21135: *130 open() “/var/www/trisect.uk/web/wp-json/wp/v2/pages/54/autosaves” failed (2: No such file or directory), client: 2a02:8010:d004:0:b4f8:e0a1:9da9:db6f, server: trisect.uk, request: “POST /wp-json/wp/v2/pages/54/autosaves?_locale=user HTTP/2.0”, host: “trisect.uk”, referrer: “https://trisect.uk/wp-admin/post.php?post=54&action=edit”

    There’s no wp-json directory in the download (tried it twice) so I don’t know if I’m supposed to create it or what. I read somewhere about pretty permalinks needing to be set and I’ve done this.

    Thanks for looking

Viewing 12 replies - 1 through 12 (of 12 total)
  • Joy

    (@joyously)

    wp-json is the REST API for your site. It is a virtual address.
    Do you have a plugin that disables the REST API? Are you trying to edit a custom post type that does not specify the REST API use?
    You can take a look at Tools > Site Health to see what it says about the way your site is configured.

    This is a clean WP install, the only plugin I have running is Akismet. All I’m doing is trying to create a new page on my blog

    After checking Tools > Site health, an optional PHP module is missing and the REST API gave a 404 error.

    Weirdly though, I’ve lost the configuration lines in wp-config.php which enable multiple blogs (I REALLY don’t know how that happened). Going to tear the whole thing down and start from scratch again, I’ll repost an update (probably in a few days)

    Clean install with clean database, cleared up a few minor issues under Tools > Site health, but REST API still gives 404 Not Found error

    Please try changing your parmalink to “Post Name”. WP Rest API doesn’t play well with “Custom Structure” 🙂

    I’ve got same error.
    Publishing failed. Error message: The response is not a valid JSON response.

    my permalin is on post name.

    also this error:
    wp-json No such file or directory

    any update on this issue?

    where is wp-json ?

    If your website does not use pretty printing wp-json will not be the correct url. You will know if your site uses pretty printing because the links will be http://www.example.com/?p=3 instead of http://www.example.com/my-article-slug.

    If wwww.example.com/wp-json/ is not returning JSON data try http://www.example.com/index.php?rest_route=/. If you are at a real loss then get the output of `get_rest_url to find the REST url

    I had the same problem today morning. After reading here the .htaccess relation, I just updated a not-so-old .htaccess file and the problem was solved.

    johnkawakami

    (@johnkawakami)

    I just had this problem. My symptom was that no permalinks worked. The fix was to alter the Apache config for the directory, adding:

    AcceptPathInfo on

    I think you can add it to .htaccess, but I added it to the server’s config.

    If this is on, then URLs like /index.php/path/to-page/ will work. Apache will look for a path to a file that exists, and then pass the URL to that file.

    My secondary problem was that my .htaccess wasn’t being read at all, because options were not enabled. At this time, I’m using .htaccess, but it would be more efficient to move these up into the server config, so you avoid reading an extra file.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.