Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the purpose of each of the HTTP request types when used with a RESTful web service?

user-image
Question added by Yasmeen Husam , Web Developer , Al Fahid Systems
Date Posted: 2019/04/07
Georges Youssef
by Georges Youssef , Head Of IT , Malak Intertainment

RESTful web services heavily rely on HTTP by design. They use different HTTP methods to perform their job and uses HTTP response code to inform clients about success or failure of a particular request. REST stands for Representational State transfer and it uses HTTP to allow two systems to communicate via remote calls. RESTFul web services is a collection of REST URI which points to resources. These URI can point to a single resource of a collection of resource. For example, you would expect /employee/101 to contain details employee with 101 and /employees to return a list of all employees. In RESTFul web service, HTTP request types signify the action to take for the resource. For example, by using HTTP GET request on /employee/101, you can retrieve details of that user. By using POST on employe/102 would create a new user with employee id 102, PUT request type on /employee/101 can be used to update details of employee with id 101 and DELETE method on /employee/101 can be used to remove data for that id. By the way, in the case of PUT and POST method representation would be in the request body. See RESTful Web Services by Leonard Richardson, Sam Ruby, and David Heinemeier Hansson for more details. One of the best book to learn fundamentals of RESTful WebService. Read more: https://javarevisited.blogspot.com/2016/04/what-is-purpose-of-http-request-types-in-RESTful-web-service.html#ixzz5kd5SGJgS

seydou sow
by seydou sow , FullStack Developper , Ba Eau Bab Senegal

Restful web request URI are well talkative. An URL /employees would you all the employees and adding / should show you the one having as it's identifier.

By using HTTP GET request on /employees/, you can retrieve details of that user. By using POST on /employee/ would create a new user with employee id, PUT request type on /employee/ can be used to update details of employee with id and DELETE method on /employee/ can be used to remove data for that id.

More Questions Like This