REST API
An answer from the REST API. It’s a Json object, that was send to a Linux terminal via curl ( it’s a tool to transfer data from or to a server).

“WordPress 4.7 comes with REST API endpoints for posts, comments, terms, users, meta, and settings.” (Source: WordPress’ text about the API).

One of the great news in WordPress 4.7 is the REST API. Now it is possible to exchange data in the form of Json Objects.

Let’s try out the REST API in a simple terminal. In bash try this:

curl http://research-wordpress.dk/wp-json/wp/v2/categories

Perhaps the result above seems like gibberish to the uninitiated. But if we use a Json parser online, you’ll get a human readable result.

The Json object unfolded. You can see one category.
The Json object unfolded. You can see one category.

If you’re eyes are in top condition, you can see:

  • name: “Book Review”
  • description: “As a researcher I read a lot of books … etc.”

So a standard WordPress installation is able to exchange data between a behemoth of platforms, such as apps on mobile devices, and any kind of code that’s able to process Json, such as:

  • Ajax
  • Python
  • Bash
  • PHP
  • Ruby
  • Nodejs
  • etc.

The possibilities are virtually endless. REST API marks a huge step foreward.

Read more: REST API Reference.


Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enable Notifications OK No thanks

We use cookies - more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close