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?
Asked
Active
Viewed 112 times
-1
fl-web
- 462
- 5
- 16
-
https://stackoverflow.com/questions/34670533/wordpress-rest-api-wp-api-404-error – Sharif Mohammad Eunus Jul 03 '18 at 07:16
2 Answers
1
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.
if it not works, maybe you need to enable mod_rewrite, on ubuntu:
a2enmod rewrite
sudo service apache2 restart
Sharif Mohammad Eunus
- 826
- 8
- 14
0
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
The actual url of the rest is possible to figure out by the next code:
echo get_rest_url();
fl-web
- 462
- 5
- 16