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.
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
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
The above path shows to access resource from the dodhytech.com/blog with blog is equal to 10