JSON REST API: Version 0.2

It’s that time of week again folks (and actually on-time this time)! Version 0.2 of the JSONJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/. includes my changes from the past week, including:

  • Allow all public query vars to be passed to WP Query – Some private query vars
    can also be passed in, and all can if the user has edit_posts
    permissions (#311)
  • Pagination can now be handled by using the page argument without messing
    with WP Query syntax (#266)
  • The index now generates links for non-variable routes (#268)
  • Editing a post now supports the If-Unmodified-Since headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes.. Pass this in to
    avoid conflicting edits (#294)
  • Post types and post statuses now have endpoints to access their data (#268)

You can also view all changes if that’s your style.

As you can see, it’s a bit of a quiet week in terms of new features, but with the exception of revisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision., attachments, and comments, the post APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. is now considered feature complete. Implementers can now expect that there won’t be any major changes to the post API.

Since you’ve all been so great, I’ve thrown in a bonus for this week. I’ve created a small proof-of-concept of extending the API for a multisitemultisite Used to describe a WordPress installation with a network of multiple blogs, grouped by sites. This installation type has shared users tables, and creates separate database tables for each blog (wp_posts becomes wp_0_posts). See also network, blog, site installation, which is now available via GitHub. Keep in mind that this is just a proof-of-concept, so it doesn’t have too much implemented. (This is also not covered under the scope of the GSOC project, so pull requests are most welcome!)

In the next couple of weeks, development will be focused around creating tests and example implementations. While this is occurring, I plan to also implement commenting, which was not in the original scope, but is still fairly important.

As always, feedback is welcome!

#gsoc, #gsoc2013, #json-api, #rest-api