WordPress REST API – Mobile Apps

Standard

WordPress, not just for bloggers

I love WordPress!

Unfortunately, in my everyday job, as a software engineer, I do not get much of a chance to use it.

However, with the new WordPress REST API, I have been finding more and more cross-over scenarios.

The WordPress REST API, in very simplistic terms, is a way for apps and websites to communicate with a WordPress site.

Pic’N’Mix WordPress

With the WordPress REST API you can now use WordPress as an ‘Application Framework’ i.e. you can pick and choose parts of it to add to a new or existing project. Great, mature, features like user authentication, content management, media management, extensions, SEO, translations etc, can be utilised in your next project.

The best use case I have found so far is to use the WordPress REST API to supercharge Mobile App development by Pic’n’Mixing the best parts of WordPress.

Pick and mix WordPress

Pic’n’Mix WordPress

We can use WordPress as a dependable back end to our Mobile App. The mobile app stays light-weight, the only thing it needs to utilize WordPress is a Http client.

In a recent talk I did at Wordcamp Belfast I talked about the new API and showed some code examples.

Ionic + WordPress Rest API FTW

One code example, shown at the talk, used Ionic to build a cross platform mobile app that connected to the WordPress REST API.

Ionic and WordPress REST API

Ionic + WordPress FTW!

The example is very basic but shows both authentication with, and posting to, the API.

JWT (JSON Web Tokens) are used for authentication.

Once authenticated, the example goes on to show how to post to your WordPress endpoint.

The source code for the example can be found on Github.

A run through of the code will follow in my next post

One thought on “WordPress REST API – Mobile Apps

Leave a Reply

Your email address will not be published. Required fields are marked *