I am using the deprecated WP REST API v1 and AngularJS to display data grabbed through the api on a website. We are rebuilding the site and I figured that I would update from v1 to v2. The trouble is that I am unable to receive a response from the server using the new endpoint. Most of my requests involve custom post types.
This works great using version 1:
/wp-json/posts?type[]=news&filter[posts_per_page]=10&page=2
But updating the request to this (version 2) does not work, it returns an empty array:
/wp-json/wp/v2/posts?type[]=news&filter[posts_per_page]=10&page=2
How do I convert my existing requests into a format that will work with version 2? The documentation at http://v2.wp-api.org/reference/posts/ is a bit confusing and lacks any examples of request that have substance.
Thanks!
curl http://demo.wp-api.org/wp-json/wp/v2/posts
actually works for me here. You can check this in your browser as well.—
P.S. sorry to post this as an answer, apparently I don’t have enough reputation to post comments.