This is a sample of RESTful api that you can follow and use to make your own api. I've followed and read through a series of tutorials on the web to get to know about and build my own RESTful api. Please finish each of them, and only then move to the next part to clearly understand the total process.
The basic guideline to start working with RESTful api is:
a. Getting to know RESTful api:
1. What RESTful api is and how it works: the single best explained guide:
http://code.tutsplus.com/tutorials/a-beginners-guide-to-http-and-rest--net-16340
2. The wiki on REST (Optional, but necessary to know the underlying theory):
https://en.wikipedia.org/wiki/Representational_state_transfer
b. Getting to know PHP:
1. Get to know PHP syntax:
http://www.tutorialspoint.com/php/
c. We will be using 'Slim' microframework to aid our api building process. The cause of picking Slim rather than others is simple, it's very lightweight and it targets as well as solves only one problem: building api. http://www.slimframework.com/
d. Starting to build api:
1. One of the most easy and well-explained api tutorial: (it has two parts)
http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/
e. Deploying api: We have finally built an api that works from localhost. But we need to deploy it on a server to see it in action over the net. I've already deployed it on Amazon EC2 server. But here, I will rather focus on how to upload that on Heroku.