Showing posts with label Restful. Show all posts
Showing posts with label Restful. Show all posts

Wednesday, January 15, 2014

Some notes in Restful APIs

There are many tutorials describing RESTFUL APIs, but here I would just highlight some of the things that I think they are really important:

  • HTTP request and response consists of Header "template based text" and Body "any format". the content type of the body is specified in the header "i.e Content/Type: application/json"
  • S = Stateless: means every transaction or request to the server is independent from others


  • HTTP verbs:

- GET: a read-only request from the server for a certain URL to retrieve data. But the the client can do some processing on the coming data such as changing the appearance. Body is Empty.

- PUT: mostly used for updating data (with a specified URL i.e id) but also can be used to create data on the server. Body has data.

- Delete: the opposite of put for this specified URL. Body is Empty

- POST: mostly used for creating resources but without a specified URL. Body has data.


  • Idempotent methods: whenever they are repeated the result is the same. PUT "the specified url has been updated or created by its ID", DELETE "deleted once, a repetition has no effect as it is already deleted", GET "retrieve the same data as it is a safe operation no data will be changed".
References: