Explore the WordPress REST API with the New Interactive Console Plugin

WordPress REST API project lead Ryan McCue, in cooperation with Automattic’s Engineering team, released a REST API Console plugin on WordPress.org today. It’s a basic console that fits right into the WordPress admin and allows you to explore the API, make small changes, and find out what your site is exposing.

“This is a forked version of the WP.com console that myself and members of the Apollo team at Automattic worked on,” McCue told the Tavern. The console was converted in approximately four casual days, and McCue credits Beau Collins for this, as he originally wrote the majority of the console for developers working on WordPress.com.

“It’s pretty useful for exploring the API as a learning tool, but also for developers who are extending the API to get a sense of how their stuff fits in,” he said.

The REST API Console plugin requires the WP REST API plugin version 2.0 or later. You can find this on the GitHub project page and version 2 should be up on WordPress.org within the next day or two. Once you have both plugins installed, the console is visible in the admin under Tools > Rest API Console.

You can actually make changes to your site using the console, so it’s advisable to install it on a local site and play with it there. While the GET requests can’t change anything, the other types can edit or delete posts (which would end up in your trash).

The plugin can only connect to the local site you’re currently on and cannot access remote WordPress sites. McCue recommends using something like Postman or Paw if you want to play around with remote sites.

In the future, he hopes to add more features and improve the plugin’s parameter documentation.

“The older WordPress.com console had the ability to click through to links, so I’d like to re-add that at some point,” he said. “The parameter documentation and tooling hasn’t been fleshed out yet, but the plan is to do it eventually – we’re working on exposing more from the API itself, too.”

If you want to tinker with the API but don’t have a local testing site handy, check out the live demo at demo.wp-api.org where you can click around to explore. This will save you the trouble of installing the plugin, if you just want to try it out. Also, you can’t perform any destructive changes there. Version 2 of the WP REST API plugin should be available on WordPress.org within 24-48 hours.