A year ago i developed an iOS application that was connecting to a server with HTTP requests exchanging JSON files, etc... I was told at that time that the server was a web (REST) service. I didnt care much since for me it was just a black box.

Recently, I've been developing a hybrid mobile application where i use native code + jQuery mobile for the front-end part and PHP + MySQL for the back-end part. The application is for registering new users to the database, having users to subscribe in various kinds of events, get notifications on them, etc...

So for all the communication between the front-end (client) and back-end (server), I make HTTP requests (POST) and Ajax calls using JSON files. For example, if I have a subscribe button and is clicked, I make an Ajax POST request sending in the body a JSON file with all the information needed, like user ID and categories to subscribe, to a PHP script. The PHP script then makes all the necessary actions in the database.

Is this a RESTful Web Service? I am a bit confused on the definition of REST. According to Wikipedia REST is:

REST-style architectures conventionally consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses.

So is what I am building a RESTful Web Service? Also do we call REST only the server part or in general the client-server architecture?

From other questions I read that a non-REST web service would manage a database like:


and a REST web service would just "expose an API with a single base resource":


I'm really having difficulty understanding what these things mean... Could someone try to explain to me when a service is a REST web service, maybe by giving me an example of what it is and what it is not?


2 Answers 2


The question What exactly is RESTful programming? on Stack Overflow has many very good answers - try reading through them all, perhaps something will click. I particularly like the conciseness of this answer.

My take on REST: a RESTful architecture means that each entity is accessed and modified through the same URL. To accomplish different actions, you use different HTTP "verbs" (also known as CRUD):

  • Creating entities is done via POST
  • Retrieving entities is done via GET (usually, just fetching one URL)
  • Updating is done via PUT
  • Deleting is done via DELETE

Taking the user example, each individual user is an entity. The non-REST example you included in the question gives you completely different URLs for creating, accessing and deleting the user.

In the REST example you have a base path, /user, and if you want to create a user you send a POST request to it along with the required parameters to create a user. Then to get a user's details, you send a GET request to /user/123 and so on.


A service is RESTful if all the input data can be in the URL. Either in the path, or in the query parameters is in the URL, so all of your examples are RESTful.

This is in contrast to a protocol like SOAP which requires an XML document uploaded as a POST request.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.