-1

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?

fl-web
  • 462
  • 5
  • 16

2 Answers2

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
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