RESTful API Tutorial For Beginners

In many cases we say that using REST API we get the response. What does this REST API Really Means ?! This is Going to be a tutorial about the REST API and also what all things that has to be considered when designing a RESTful API.I like to keep myself short and simple so lets jump in to our topic directly.


The term Rest API is coined by Roy Fielding - LINK. Representational State Transfer is a architectural style for communication with different distributed hypermedia systems. Defenition dont sounds Good right? Lets take an example to make it clear. You have a data base that contains the information about users of  your website.Now you are planning to develop a Ios and Android app for your website.That make use of the same data in the web server database. At that time you need to make a Restfull API to give the reponse object either in xml or json formats.

To understand about RESTful API first we need to understand how the HTTP protocol works.It works basically by request and response modal. The request can be either a GET or POST. GET caches the data at the client side and POST doest caches the data.HTTP verbs are used to specify what action to be done in the specified URL(Locates a resource in server).

POST /user/xxx

Where the POST is action specifying what action to be done. Similarly there are other http verbs like GET,PUT,DELETE.

Eg for a REST API


The above URL can be made to request the detail of user “xxx”. So that we get the data in json or xml format. This could be easily done in using php.

user?id=”xxx” in the url is same as the user/xxx. Where the .htaccess file is used to rewrite url. So it easy to get the name of the user and giving a json response in php.



Defenetly not.A RESTful API is still more than it.Many say that their application has a REST api. Even you might have one. Lets check weather it is using REST api.To say a application uses a REST API , it must consider 6 constraints.If it satisfys all of it, then it is said to be REST api


  • Uniform Interface
  • Stateless
  • Cacheable
  • Client Server
  • Layered System
  • Code On Demand
Uniform Interface is that the REST api must be designed such a way that every resources must be uniquely identified and also it is self descriptive.(ie) for better understanding ill explain with a example.
 The above url design gets all the members in the URL and their detail.Simple design.But It is not considered to be a good one.Every resource must be uniqly identified and hence we change the design as
Where member_id uniqely identifies every members record.
Stateless is there wont be any relation between the two packets sent from client to server or server to client.Newly sent packet should not rely on the previous packet to complete its task.
Cacheable: The content you sent must be cacheable. Because the packet sent to the server are sent through various systems ,gateways.It gets cached every where.So when the same packet is requested again , intermediate gateways itself must be able to respond to that packet.
Client Server: We seperate the client user interface side with the server side. Thus extending the scalablity to multiple platforms.
Layered System:In layered systems are connected in a heirarchichal manner and we hide the informations from one layered systems with another.Thus overall complexity is reduced.
Code On Demand is including the certain seet of codes only when it is needed, eg – javascript code is included when ever it is needed .
Only if it follows all the above constraints it is considered to be Restful API.It is a beginners tutorial and hence i just summatized the constraints. To know in detail refer the link 
Some popular applications where we have heard rest API is facebook API,Yahoo place finder API,youtube API,Twiter etc.Twiter REST API eg link -
Hope this article has given you a basic idea behind RESTful API.Follow our blog for future updates.
If you like this post, contribute us by sharing this in your network
Ver peliculas online