open kadamwhite/wordpress-rest-api#106

WP api version

tommedema

It's not mentioned in the readme: is this driver for the v1 or v2 edition of the WP API plugin?

kadamwhite

@tommedema 1.0, but some methods will work with 2.0 and I will be updating the library to work fully with the latest Ali plugin in the coming months

tommedema

@kadamwhite is there a way to know which methods? I mostly need to create, request, and edit posts, upload media, and manage tags / categories.

kadamwhite

@tommedema unfortunately the only way to know right now is to test. I'm planning to put together a compatibility list but I'll be away from the office for several days, so I won't have an opportunity to do so until the second week in September.

I've heard anecdotal evidence that at least most of the post retrieval methods work in 2.0, and if you try it out id love to know what you find around the rest of them!

jasonphillips

I've begun working on 2.0 compatibility in my branch here: https://github.com/jasonphillips/wordpress-rest-api/tree/APIv2

So far, I have updated the taxonomy handler and its routes to work with all the new API paths (significant changes in 2.0 for accessing terms), and updated the tests. That is working well for me in a current project against 2.0; I'll continue to make further updates as I encounter other incompatibilities.

I could of course put in some pull requests later if public work on a branch over here for V2 begins.

kadamwhite

@jasonphillips I've seen the work you're doing on your fork, and have begun updating the core library along similar lines.

I would like your eyes on the changes I've made so far—the 0.6 release will support the API v2, and you can download the beta now via npm install wordpress-rest-api@beta. Major changes:

  • The endpoint you pass to the client should still be the path to the API root (wp-json); but .posts, .pages etcetera automatically set .namespace('wp').version('v2'), two new methods provided for customizing the version and namespace against which a query is being made
  • a .perPage method has been added to support pagination handling in the v2 betas
  • a .embed method has been added to support embeddable response data
    • so far I do not do any transformation of the response JSON, so this comes back as an _embedded property on the response object
  • Switching to using the new _links format is still TODO
  • The new taxonomy handling is still TODO

I would love your input on these changes if you're interested