WordPress 4.1 and the New WP API
With the release of version 3.0, WordPress moved from being a blog platform to being a content management system.
WordPress 4.1 may officially announce the arrival of WordPress’ next transition, this time from a content management system to an application framework.
This change is already underway with WordPress being used for lots of apps and and external software. OSTraining members can download a whole book on building applications with WordPress.
4.1 is likely to accelerate that change by providing an API directly from the WordPress core.
The WP API Project
WP API is currently available as a plugin: http://wordpress.org/plugins/json-rest-api/.
This goal of the plugin is makes it easy to interact with your site’s data including users, posts, taxonomies and more. The plugin allows you to update your site from outside of WordPress. If you can do it with WordPress, you’ll also be able to do it remotely using the WP API.
The API uses JSON which is a very popular data format because almost every programming language can understand it. Any program which can access the web can use the API, leaving developers only the WordPress-specific code to write.
Who’s Behind This Project?
Ryan McCue is a Australian developer with a very strong background.
Ryan works for Human Made, a WordPress agency in the UK that’s one of the few to qualify as a WordPress VIP Partner.
Ryan’s also one of the developers behind SimplePie which became almost the standard solution for parsing RSS feeds in PHP. If you’ve used WordPress, Joomla, Drupal, Magento or any other PHP platform, there’s a good chance you’ve used SimplePie.
At its core, SimplePie is a code library which provides an API. SimplePie is used so widely that the developers have a lot of experience in making their API easy-to-use and compatible with different platforms. Sound like WordPress? The SimplePie goals even borrow directly from WordPress’ famous 80/20 maxim:
“SimplePie will be ‘just right’ out-of-the-box for 80% of our developers. For the other 20%, we have numerous configuration options available designed to allow you to fine-tune and hack away to your heart’s content.”
So, Ryan comes one of the most popular open source API projects in the world and one that shares the same philosophy as WordPress. In addition to SimplePie, he’s been working with the WordPress core for 6 years.
How Will This Change WordPress?
Ryan talked about the potential impact of the WP API when he was interviewed by WPTavern last year:
“The JSON REST API is a simple but powerful way to interact with WordPress. Mobile, desktop and web applications can get data from WordPress and do anything you can do via the admin panel. It’s like the admin panel, minus the UI. This project will affect everyone who works with WordPress. Mobile and desktop applications can move past restrictions on WordPress’ existing APIs and start working with WordPress in much deeper ways, while themes and plugins can become much more interactive. The availability of this as a core feature also means less time spent by developers creating something similar, and more time spent creating actual features.”
Ryan shared some practical examples:
- “Mobile apps will be able to replace the clumsy XML-RPC-powered APIs with a much smaller set of tools for dealing with this API, enabling them to spend more time working on cool features and less time fixing issues … the current mobile apps use the XML-RPC API, and up to 40% of their code is just to understand the XML properly, whereas JSON support is built-in to iOS and Android natively.”
- “The upcoming O2 theme by Automattic (intended as a replacement for P2) includes a similar API to power the live reloading, commenting, infinite scroll, frontend posting and other features. Once this plugin is in core, the O2 developers will be able to replace their custom code with this API (which I hear is a significant portion of their codebase)
From a Plugin to the WordPress Core
A year ago, Ryan started a Google Summer of Code project called JSON Rest API.
WP API is on Github and has over 30 contributors, but Ryan has contributed the bulk of the commits.
From the very start, the idea was to develop this plugin so that it could be incorporated into the WordPress core. The plan was to follow the same approach as MP6 and other features which start as a plugin before being adopted into the core. At the moment, WP API is on track for inclusion on WordPress 4.1 which is due in December.
Integration With Major Plugins
It’s likely that the core WordPress API will lead to an explosion in compatible API offerings by major plugins. Already at least three major plugins are working on their own additional APIs:
- BuddyPress: https://github.com/modemlooper/buddypress-json-api
- Pods Framework: https://github.com/pods-framework/pods-json-api
- WooCommerce: http://woothemes.github.io/woocommerce/rest-api
Expect to see this list grow much longer as WordPress 4.1 approaches.
- The WP API site: http://wp-api.org/
- WP API Documentation: http://wp-api.org/guides.html
- WP API on Github: https://github.com/WP-API/WP-API
- WordPress REST API Team site: http://wpapiteam.wordpress.com/
- Google Summer of Code posts: http://make.wordpress.org/core/tag/json-api/
Fantastic! Please see my idea in how to use a GUI to use API and hooks in WP plugins [url=http://wordpress.org/ideas/topic/revolutionary-core-changes-33-like-iftt-plugins]http://wordpress.org/ideas/…[/url]
Yes, great point. Plugins could talk to each other far more than they do now.
Thanks Steve, and I really enjoyed your article, very well written and also good news for the whole community – and kudos for Ryan McCue!
Please add OAuth UI to this plugin
WordPress 4.1 will arrive with a new and improved distraction free writing mode. Many beginners usually don’t know about the distraction free editor, and those who know about it don’t find it very helpful. The new distraction free writing mode makes it much simpler to switch back and forth between normal writing mode and distraction free editor.
The API will enable front end developers to build themes on WordPress without needing to know PHP or many of WP’s quirks.
how to built API in wordpress
I want to use WooCommerce REST API to Access Products in JSON formate , please help me how can i start, i know about basics but not in correct way.
I am totally confused how can i start this.
Corrently I am using this url