I’ve been working with WordPress since 2007.I also write C# and JavaScript and build on the front end with HTML and CSS.Since I use so many different technologies and services, learning how to make them talk to one another has become a necessity.
There are a variety of technologies available to make WP and other systems work together.Some let you pull data in to WordPress from external services.Some let you selectively expose WP’s data to outside consumers.Some are easy to use … some aren’t.
ReST is an abbreviation for Representational State Transfer. Essentially, it’s a way to request objects from a web resource.Twitter is a ubiquitous example of a ReSTful web service. Every tweet, profile, conversation, etc is an object on the server and can be requested by building the right URL.In this screenshot, you see I’m requesting that Twitter show me a status with a specific ID in an XML format.But ReST doesn’t have to be XML.Other services will return just a string, or some JSON data, or any other format they’ve decided to standardize on.
RPC stands for Remote Procedure Call – it’s a way to execute commands against a remote server by sending XML data to it.Your site is actually an XML-RPC server. If you’ve ever used an iPhone/Android app to control your site – or just installed JetPack – then you’re using your site’s XML-RPC functionality.
If you work with JavaScript, then you know JSON. It’s a great way to serialize data and tends to be smaller than XML.There’s a plugin available for WP that allows you to request pages, posts, and comments as JSON objects rather than HTML pages.We won’t get in to this system today, but if you’re interested, check out the JSON API plugin later.
Live code example – retrieving the Twitter search results for “#wcphx” and embedding them in a page.
Live code example – changing the search query for the Twitter example using an Android device.