How to Create APIs for Your WordPress Blog

You Are Here

Ever wanted to show off your blog with a mobile app? Ever wanted to integrate your posts on some other website? Well, now you could! All you need are some APIs for your blog and a little programming knowledge to create that client app.

First things first, what are APIs? Well, APIs are Application Programming Interface. Basically, they help you to transfer data from your server to a client using some links and functions. That’s okay but how the hell do we make one? Well, to know that, first we need to know what kinds of APIs are there.

The two most famous forms of transferring data between two parties over the internet are through using XML data or the newly formed JSON data. XML stands for eXtensible Markup Language and is very similar to HTML but is used for the purpose of sending data only. JSON stands for JavaScript Object Notation and is the easier of the two (don’t worry, no kind of JavaScript is involved in here). Both are very easy to install on server and consumption of these services ain’t a big headache as well.

So how do we go about installing them anyway? Have you ever wondered how do the sites generate feeds for your blog? What they do is they look up for rss.xml file on your server and consume it to make those feeds. Every WordPress blog has it by default. To locate your rss file, go to the link www.yourblog.com/feed/rss . This will be your rss file! This allows you to find information of the past ten posts and is used by the RSS reader applications. But this is not flexible enough and provides information about the last ten posts only. Luckily, there are JSON APIs to save your day!

Of course one way to do it would be to create them for yourself but that would require in-depth knowledge of PHP and WordPress. But to make life easy, we have other methods too, like plugins!

To install JSON APIs, just download this plugin and you are good to go. These give you rich set of JSON APIs and the Plugin page also shows you how to use these APIs in your application. If you want APIs for one particular post, just append “/?json=1” to the link and voila, there they are.

Here are some tutorials to use your APIs for different platforms:-

  1. Android
  2. iOS
  3. Java
  4. PHP

Enjoy your very own RESTFUL APIs. Do tell us some different and interesting ways you used them in your applications.

Previous:
Next:

Vishal Gaikar

Article by Vishal

I am Vishal Gaikar, Software Engineer, Web Addicted, Living in Maharashtra, India. If you like This post, you can follow Tricks Machine on Twitter, also you can add me on Google+.

Get Free Updates in Your Inbox!


Share This Post On Social Network

5 Benefits Of Guest Blogging
Set Up Your Own E-Commerce Site with Shopify
3 Reasons your blog's PageRank isn't Increasing
Everything About Responsive Websites & Parallax Websites: Choose Wisely!
© 2008-2016 - The content is copyrighted to and may not be reproduced on other websites.Designed by Vishal