As many of you are aware, I was accepted into Google’s Summer of Code program this year to work on a JSON REST API for WordPress. WordPress already has internal APIs for manipulating data via the
admin-ajax.php handler in addition to the XML-RPC API. However, XML can be a huge pain to both safely create and parse, and the existing admin API is locked down to authenticated users and is also tailored to the admin interface. The goal of this project is to create a general data API that speaks the common language of the web and uses easily parsable data.
I’d now like to introduce the official repository and issue tracker. There’s also the SVN repository which is kept in sync.
For the next few months, my schedule will be busy implementing the API. Each week from now through the final submission has an individual plan, presented below.
May 27: Acceptance of Project, ensure up-to-speed on existing code
June 3: Work on design documents (response types/collections) and ensure agreement with mentors and interested parties (#264)
June 10: Complete core post type serialisation/deserialisation (basic reading/writing of raw data complete) (#265)
June 17: Work on collection pagination and metadata infrastructure (the full collection of posts can now be accessed and is correctly paginated, allowing for browsing via the API) (#266)
June 24: Creation of main collection views (main post archive, per date, search) (#267)
July 1: Further work on indexes and browsability (#268)
July 8: Create (independent) REST API unit tests for all endpoints covered so far (#269)
July 15: Creation of a Backbone.js example client for testing (#270)
July 22: Spare week to act as a buffer, since some tasks may take longer than expected
July 29: Midterm evaluation!
August 5: Creation/porting of existing generic post type API with page-specific data (#271)
August 12: Creation of attachment-related API (uploading and management) (#272)
August 19: Creation of revision API, and extending the post API to expose revisions (#273, #274)
August 26: Creation of term and taxonomy API (#275)
September 2: Finalisation of term and taxonomy API, and updating of test clients (#276)
September 9: Final testing with example clients (especially with various proxies and in live environments) and security review (#277)
September 15: Spare week for buffer
September 22: Final checking for bugs and preparation for final submission
At the end of each week throughout development, I’ll post a weekly update and tag a new release version, in a manner similar to the release process of MP6. The first release of the API will be posted shortly.
For those looking to keep track of development, I’ll be posting about the API here, which you can follow via the feed. A GSoC P2 is on its way and will be the official place to post comments and feedback (I’ll be crossposting back to here once that’s up). In the mean time, I’ll be posting on this blog and accepting comments here, which is a great way to ask questions and post feedback.
13 thoughts on “Introducing WP API”
Looks promising. Keep it up ;).
Very cool, I’ll be watching closely via GitHub, can’t wait to start integrating this with my own project!
Do you plan this to be a single-blog API? What about multisite?
Multisite isn’t in the scope for the GSOC project, but it’s possible to do right now with some filter trickery. That said, post-GSOC, it’s something I’d love to tackle.
JSON > XML – thank you.
This is one painful problem you are solving. Thanks for this, my friend.
I have been fiddling with this and that plugin, custom code, etc, but something from the core is always nicer to work with, gives a sense of uniformity.
Is there a plan to implement oAuth for remote login, especially for create methods?
This is outstanding! 🙂 Thank you for working on that GSoC project.
I had to implement my own solution months ago to make all data on my blog available as a JSON REST API. Once you finish your project, I’ll probably flip the switch and start using your code.
Wish you all the luck!
Thanks for working on this. Last github commit was the beginning of August. Did the project peter out?
Looks like you are tracking about 60% completion of tasks. (http://goo.gl/Rdcsua)
According to your schedule, where would you say you are on the current master branch?
Thanks for committing a bit more. I’m not a PHP guy, so I may be doing something fundamentally wrong. I was not able to get the “Core” installation working. I believe your wp-json.php file in 0.5-dev is out of date and didn’t have includes for posts, pages and media classes. I added these, but it broke again since you have moved json_url into plugin.php. I then attempted the plugin approach, but there are references to missing functions (WP_JSON_Media::getAttachment()) which cause the simplest calls to fail.
I’m sure this will be a good project when it is done. I’m probably just a bit too early. 🙂
Sorry for not getting back to you earlier. There’s a post on Make/Core about the delays with the project.
I’d definitely recommend using the plugin method. The missing functions are just a result of the fact that I’m working on the media stuff at the moment, but that should be fixed now (fingers crossed).
If you want a more stable version to work from, grab the plugin from the WordPress.org repository instead.
I’m excited to start implementing major integration with this, how has the reception been by core of this project and is it marked for inclusion in core at some point?
The reception from core has been fantastic, and it’s something that I’d say will definitely make it in to core, the question is just the timeline. At the moment, it’s provisionally scheduled for 3.8, but that will be discussed after the Summer of Code period ends.
That’s great! I’m looking forward to diving in to extend with my own endpoints.