External WordPress API

I’d like to manipulate a WordPress website from another program/website. IS there an API already written that provides access, and authentication, to do this?

Ideally, I’ll be using a multi-site wordpress instance and I want an outside program to add new sites, send config options to plugins, etc.

3 Answers
3

As of WordPress 4.7 (released December 2016), a REST API is provided out of the box on WordPress.

As you’re probably aware, REST APIs are interfaced with by standard HTTP GET and POST requests, so if you have a WordPress 4.7 installation, you can access it at this URL, by plugging this into your browser:

http://your.site.com/wp/v2/posts

Further reading:

  • WP REST API, User Guide
  • WP REST API, Developer’s Guide

Important side note:

Because this is turned on be default, because this exposes endpoints that can changes your data (via POST/PATCH/DELETE requests), and because WordPress prefers you not to disable it, you really really ought to turn on some form of authentication. Thankfully, turning on basic WP logged-in authentication isn’t particularly hard, and there are plugins that will enable OAuth.

Leave a Comment