This week is a little different to the previous ones, as it’s a primarily testing focussed week. I’m skipping the release for this week in favour of just an update post.
I noticed fairly late this week that the aforementioned client library wasn’t actually public and available to you guys, so I’ve now fixed that up. Given the lack of comments, I’d hazard a guess this also means no one tried using it. 🙂
Over the past week, I’ve been looking at a variety of testing-related items, including code coverage and schema validation. I’ve finally sorted the schema validation out with the help of a JSON Schema validation library, after much messing around. The unit tests now integrate this schema validation with the normal testing suite, which should ensure that the API 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 conformant to the specification as well as fully functional. I do suspect that the schema is slightly outdated and is missing a few items, so I’ll be ensuring the documentation and schema are consistent in the next week.
Another area of the testing that I’ve been looking at is working with code coverage. After exploring the inner workings of PHPUnit’s code coverage, I think I’ve worked out a solution using a test helper plugin. This gathers the statistics on the server, then serialises them to send them back to the client. This still needs the PHPUnit end to connect to, which should be simple once I work out how to override the
PHP_CodeCoverage object. (Help here would be appreciated if anyone has familiarity with PHPUnit.)
Next week, you can look forward to more testing updates and the Backbone client. I’ll also be pushing out a new version with some bug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. fixes (thanks to Mike Schinkel for reporting these) as well as the usual slate of updates.
I’ve also discovered that my documentation thus far has been a little lacking, so here’s a bit of an intro to using the API.
After downloading and activating the plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party, your site will now capable of serving up data from its API. The API is accessible at
/wp-json.php from your site (if you’re not sure where this is, copy your admin (and super admin) URL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org and replace
wp-json.php), with the specific route added after this. For example, the index is available at
/wp-json.php/ and a list of your posts is available at
Some endpoints will add extra data if you’re logged in with the correct permissions. You can log in via the normal WP login page if you’re just viewing this in your browser (using cookie-based authentication), but if you’re accessing the API programatically, the API also has built-in support for HTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. Basic authentication. (OAuth support is not planned for the core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. of the plugin, but my OAuth provider plugin might be a good start for anyone who wants to write this as a plugin.)
I’m always open to questions regarding how to use this, so let me know here or on Twitter if there’s anything I can do to help you out.