Home / REST / Communication between Client and Server in Restful System

Communication between Client and Server in Restful System

In Restful System for any communication client has to initiate request. Client request has following division

  • An HTTP Verb, which define what kind of operation client want to do.
  • A header, which allow the client to pass along information about the request
  • A Path, which is the path to the resource i.e. URL
  • An Optional Message, which is additional message along with the client request.

HTTP VERBS

There are basic four types of requests that normally client do to interact with the resource in the REST System.

  • GET — retrieve a specific resource (by id) or collection of resource.
  • POST — create a new resource.
  • PUT — update a specific resource by id
  • DELETE — remove a specific resource by id

HEADERS / ACCEPT PARAMETERS

In the header of any request, the client can pass the type of the content that is able to receive from the server which is called Accept field.

This assure server not to send any other type of the content that a client cannot understand or accept. The options of the types of content is called MIME (Multipurpose Internet Mail Extensions) type. Examples of MIME types are as follows

  • text/html, text/css, text/plain
  • image/png, Image/jpeg, image/gif
  • audio/wav, audio/mp3
  • video/mp4, video/avi
  • application/pdf, application/xml

PATHS

Each request must contain path to the resource. PATH normally is the URL of the resource. We can pass parameters along with the PATH. Example

dodhytech.com/blog/id/10

The above path shows to access resource from the dodhytech.com/blog with blog is equal to 10

Leave a Reply

Your email address will not be published. Required fields are marked *