I’m brand new to WordPress
and I would like to use the JSON API
plugin.
So I put it in my plugin repository and I activated it but when I try to display the Json
response by accessing the http://localhost/wordpress/wp-json/posts
url I get a 404
error.
I’m probably missing something but according to the documentation it should be that simple. Any idea of what am I doing wrong?
It is an mod_rewrite issue.
Reason is one of these in your .htaccess:
Try the htaccess documentation on WordPress for your .htaccess:
Old question and answer, but for anyone coming here recently via search results (like me), /wp-json/posts should at least bring a JSON result (albeit still a 404 error), and /wp-json should list some available routes in JSON.
If it doesn’t (e.g. it shows an Apache or other 404 error page), it’s probably a permalinks issue
You have the wrong address. According to the documentation, the following are valid links:
Implicit mode examples:
Explicit mode examples:
With user-friendly permalinks configured:
Source: https://wordpress.org/plugins/json-api/other_notes/
So in your case you should use
http://localhost/wordpress/api/get_recent_posts/
/wp-json/elementor/v1/globals – 404 error
Just update the plugin if any update is available and deactivate it first and then re-activate it again. The problem will be solved.
When we activate the Elementor plugin then this plugin creates some essential files for editing, so when we will re-activate it then it will re-create all essential files and our problem will be solved. Thanks
It may depend on whether you have NGinx or Apache.
On some hosts with Plesk if Nginx is used, Plesk does not create or re-create the .htaccess file, but for WP it must be present.
If it’s not there, just recreate it with the standard WP settings https://wordpress.org/support/article/htaccess/ as mentioned in one of the previous answers.
A workaround (insecure) is to create directories and files /wp-json/elementor/v1/globals with {} like Json standard, elementor will work the same, but I don’t recommend doing that.