What is RESTful Service?
Mohan Brahmmadesam Manavalan
Javascript | React | NextJS | Redux | C# | .Net Core | Express | Typescript | Azure
Web is a place where there are tons of computers talking to each other. As the web grew, it became clear that we needed a common and secure way to allow others to interact with our application. This need gave rise to Representational State Transfer Architecture or more commonly known as REST architecture. REST defines a set of constraints for how the web should behave.
REST defines a?client-server communication model. The device making the request is called the?Client?and the device which is listening for the requests is called a?Server?The server is in charge of the resources. A resource can be anything like a HTML file, a JSON object, an image file or event a JavaScript file. The client-server communication happens with HTTP/HTTPS protocols. The actual logic for fetching the resource is abstracted behind the server and the client has no idea about what happens in the server. The resource might be fetched from the server the client requested or it can be fetched from some other server. The only thing client is concerned is that if they are getting the resource or not, and if they don't receive the resource, what is the reason for that? REST is also?Stateless, which means that the server has no idea about the previous calls from the client. The server does not hold on to information's for the client. A web service that obeys the REST constraints is called a?RESTful service.
The Client calls the server using http methods and gets a http response code and http response status along with the resource as the response. The most commonly used HTTP methods are
The response codes from the server are in the following categories
Successful responses
When we get the expected response from the server. This includes the following status codes
领英推荐
Client error responses
When there is something wrong with the request made by the client we get one of the client error response.
Server error responses
When there is something wrong with the server, then we get one of the server error response.