The WordPress REST API for Complete Beginners

Hi and welcome.

Note:  Site being redesigned MAY 2016

build website wordpress

The REST API is considered to be one of the most important additions to WordPress.

The REST API currently exists as a plugin (WP REST API) ,

It has been partially added to WordPress (WordPress 4.4) .

REST APIs are in use throughout the Web.

The additional of a REST API will enable developers to build applications in any programming language and running on any platform that can access WordPress.

Using the WordPress API the content of WordPress sites can be accessed by other sites and clients.

It will allow remote systems to retrieve,edit and add content to a WordPress site.

Possible Uses

  • Client based themes and templates
  • Mobile Apps
  • Mashups using other data from other Sites
  • etc

What is an API?-

In computer programming, an application programming interface (API) is a set of routines, protocols, and tools for building software and applications.- Wiki

What Is REST?

REST (Representational State Transfer) is an architectural style for building APIs.

The data transferred between WordPress and remote systems is encoded in the JSON format.

What Is JSON?

JSON- (JavaScript Object Notation) is a text based data exchange format widely used on the web for transferring data between two systems.

Although it originated in JavaScript it is used in all other programming languages- Wiki.

Getting Started

Communication between a remote system and WordPress uses the http protocol, just like when accessing a standard web page.

In order to do tests and view requests and responses you can use a standard web browser, or better still an http client.

You can use:

A Simple example

To demonstrate the API in action I am going to use a standard web browser to get a list of all posts on a test site.

Setting Up a Test Site

To become familiar with the WordPress API you should create a test site.

You will also need some test data. You can use this theme unit test data.

You will also need to Install the WP REST API plugin.

wp-rest-plugin

About This Site

I’m Steve and I’ve been using WordPress for around 10 years and  I am currently learning about APIs, and moving back into coding.

This site is focused on passing on what I learn.


Regards
Steve

Note: if you’re a small business or personal site owner looking to simply build a website and aren’t concerned with the more technical details then visit my other site.

 

Save

Was This Article Helpful? Please Rate
[Total: 4 Average: 2.3]

Latest Tutorials


Understanding the WordPress Query- Part 2

understanding-wp_queryIn Part 1 of this tutorial series we looked at the default or main query, the wp_query object and some core loop functions.

In part 2 we look at how modify the main query and how to create custom queries. Continue reading

Was This Article Helpful? Please Rate
[Total: 0 Average: 0]

Creating New Custom WordPress Page Templates

template-selectionMost WordPress themes will come with several page templates by default.

Templates are used to display posts, archives,categories etc and there are many template files included in the theme folder.

The screen shoot below show the 2012 theme folder and highlights some of the template files: Continue reading

Was This Article Helpful? Please Rate
[Total: 0 Average: 0]

Beginners Guide to Understanding the WordPress Query

understanding-wp_queryWordPress stores pages and posts in a MYSQL database.

When you request a web page or post from a WordPress website WordPress needs to query the database to retrieve that page/post.

The database query is a collection of MYSQL commands, and must be constructed before the query is executed. Continue reading

Was This Article Helpful? Please Rate
[Total: 0 Average: 0]