Interview Question: Tell me all you know about RESTful web services.
You may start by saying that RESTful Web Services are an implementation of the REST Architecture based on web services. REST stands from Representational State Transfer and (emphasize!!) it is an architectural style, not a protocol.
REST follows a Create Read Update Delete (CRUD) like approach to retrieve or modify data. In the REST architecture the GET, POST, PUT, and DELETE verbs are used to update resources as follow:
- GET is used to read a resource;
- POST is used to create a resource
- PUT is used to update a resource (sometime PATCH can be used with the same purpose)
- DELETE is used to remove a resource.
REST architecture style relies on a stateless, client-server, and cacheable communication protocol. Client initiates a stateless HTTP request to the server which processes the request and returns a response.
And one last mention I want to say about REST is that it is platform and language independent.
Architectural principles of REST
- stateless (no client context is stored on the server between requests)
- layered system
- client-server model
REST architecture properties
- simplicity of interface
- component modifiability
- visibility of modification between components by using service agents
With REST all you need is a network connection. You can even test your API directly, using your browser.
- with REST each request exists on its own, without the server necessarily having any knowledge about prior or potential future requests.
- REST is stateless, it is resource oriented, and uses HTTP requests to post, read and delete data