WordPress REST endpoint with JSON for Mobile App integration

Is there some REST API that WordPress supports, out of the box or through any plugin that exposes the same information exposed through the normal pages? (I.e. latest posts, filtering by categories etc.)

There seems to be a JSON API plugin but it seems to be very old and not maintained.

Read More

There also seems to be some plugin called Jetpack but not sure if it provides what I am looking for (seems more dedicated to content management rather than exposing it publicly).

I am trying to integrate a Mobile App with a WordPress Blog, and I need to find the best way to transfer the information to the application in terms of performance and also displaying it right. (Any ideas appreciated)

Related posts

Leave a Reply

4 comments

  1. The REST API can be used for straight-up retrieval on any blog that has enabled it. Self-hosteds require an active choice to turn the JSON interface on in Jetpack but once it’s up it’s wide open.

    This is not necessarily appreciated by everyone, and that’s somewhat understandable. I picked a blog ID at random here for the /posts/ call:

    https://public-api.wordpress.com/rest/v1/sites/2833/posts/

    That’s the full output. If you were trying to make life marginally harder for scrapers by only providing excerpts in your RSS feed then this pretty much undoes that. It’s a pretty false sense of security – if your blog is public then it’s scrapeable – but not everyone loves this fact.

    For your purposes you can absolutely just use the API to pull individual posts and display them in an alternate manner.

  2. For the record, I’m not sure why anyone would use the JetPack JSON API as it currently works for a self hosted site. If you’re doing AJAX and JSON, the whole point is to get back some JSON data FAST. Using jetpack involves an unnecessary call to wordpress.com, which then does a call to your own self hosted blog. Using the wonderful JSON API plugin, you make a call directly back to your self hosted site, avoiding the call to wordpress.com.

    Doing some speed tests comparing loading a page (in JSON format) via the JSON API plugin and via Jetpack shows that the Jetpack JSON API takes roughly 3 times the time of using the JSON API plugin. It might be an older plugin, but it works absolutely perfectly for me!

    For anyone who wants to duplicate the tests using the two methods, install both the JSON API plugin and the Jetpack plugin, then compare (obviously replacing example.com and some-page-slug):

    • http://example.com/api/get_page/?slug=some-page-slug (this uses the JSON API plugin)
    • https://public-api.wordpress.com/rest/v1/sites/example.com/posts/slug:some-page-slug?type=page (this uses the Jetpack JSON API)

    I used webpagetest.org to run the speed tests on both the URLS.

  3. Just for the record, I have used the JSON API plugin a couple months ago and it still works like a charm.

    Actually, now that I check they have updated the plugin in June 2013, and works very well. I like it better than JetPack because is more extensible.

    Also, I came across this very recently, might be worth checking out: http://thermal-api.com/.

  4. You have a few options.

    The Jetpack plugin allows you to use the WordPress REST API on self-hosted blogs (previously, it was only available to WordPress.com blogs). This is probably exactly what you are looking for.

    Documentation: WordPress REST API Documentation

    Alternatively, all self-hosted WordPress installs also have a built-in XML-RPC API that can be used for mobile app integration.

    Documentation: WordPress XML-RPC API Documentation