3

Im trying to get the json of my homepage, before i only got the json by post id and im not being able to get it by page. This is what im trying:

mysite.me/wp/v2/pages/2304

But it just redirects me to my homepage. By post id, this is how i do it:

http://mysite.me/wp-json/mysite/v1/items/id/92570

Any help?

1 Answer 1

2

If you want to use v2 of the API (which is the current one you should be using), the endpoint is mysite.me/wp-json/wp/v2/pages/1234 where 1234 is the page ID.

https://developer.wordpress.org/rest-api/reference/pages/#retrieve-a-page

2
  • Hi there! That works great but do you know how to retrieve multiple posts by their id at once? Sep 7, 2018 at 13:45
  • @user3191334 you can use the include argument. For example, mysite.me/wp-json/wp/v2/pages?include[]=1&include[]=2 would get you pages with the ID 1 and 2. Sep 10, 2018 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.