Skip to content

WP API V2 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
CHEWX opened this issue Feb 10, 2016 · 5 comments
Open

WP API V2 #10

CHEWX opened this issue Feb 10, 2016 · 5 comments

Comments

@CHEWX
Copy link

CHEWX commented Feb 10, 2016

Any plans to support WP API V2 ?

@michaelbromley
Copy link
Owner

Would be good because I also need to update my blog to use v2. I had no idea it was even released. Do you know what the major differences are? I've not got a great deal of time to research right now.

@CHEWX
Copy link
Author

CHEWX commented Feb 11, 2016

Not a huge amount, but I went stragith into V2 instead of V1.

http://localhost/wordpress/wp-json/

to

http://localhost/wordpress/wp-json/wp/v2/posts

http://v2.wp-api.org/

@michaelbromley
Copy link
Owner

Just took a look at this. At this time, the docs state:

While we believe the API is now stable enough for public testing, we may continue to break the API in the future as we improve it further. Only use the API in development, and do not use version 2 in production environments.

So I'll hold on changing this repo until v2 is more stable.

If people want to use v2, see changes here: http://v2.wp-api.org/changes-beta-1.html - it looks fairly trivial to modify this codebase for v2.

@violacase
Copy link

If you visit http://wp-api.org you'll see that they like you to go to v2.
If v1->v2 is trivial then it's also trivial to do v2->v1.
On NPM you'll see that development is now building on v2. E.g. https://www.npmjs.com/package/wp-api-angularjs

@mroeling
Copy link

Did't have to put in a lot of effort to make the necessary changes. Little overview:

  • Minor fix in app/app.js, fix unavailability of $window.ga in case it is not defined yet
  • though not the best way, but for now since it only serves as proof of concept, the post.title references in the template are changed to post.title.rendered. Same for post.excerpt and post.content.
  • Changes because of the rendered issue also in blog/post.js, services/BlogService.js

Attached git diff snippet with the formentioned changes.
ngwp.patch.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants