Is any simple rest api simple endpoint for posts in Wordpress?

Multi tool use
Is any simple rest api simple endpoint for posts in Wordpress?
I am working with wordpress 4.9. I am trying to use new rest api. Is some api enpoints imlpemented by default? There is no /wp-json/wp/v2/posts
nor /wp-json/wp/
nor /wp-json/
is accessible. The 404
is answer. What I need to check or enable? Is any ready stub snippet to make posts rest api endpoint?
/wp-json/wp/v2/posts
/wp-json/wp/
/wp-json/
404
2 Answers
2
Change the permalink setting. Maybe you can set permalink by post name.
Dashbord->Settings->Permalink
After saving changes https://****.**/wp-json/wp/v2/posts/
should work.
https://****.**/wp-json/wp/v2/posts/
if it not works, maybe you need to enable mod_rewrite
, on ubuntu:
mod_rewrite
a2enmod rewrite
sudo service apache2 restart
Thank you. It is useful, upvoted. Actually the problem in my answer.
– fl-web
Jul 3 at 10:22
Actually rest url is differ or was recunfigured in wordpress I am working with.
The url in my case is https://{site}/rest_api/wp/v2
https://{site}/rest_api/wp/v2
The actual url
of the rest is possible to figure out by the next code:
url
echo get_rest_url();
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
stackoverflow.com/questions/34670533/…
– Sharif Mohammad Eunus
Jul 3 at 7:16