Restful Web services is considered as a very lightweight, maintainable and also scalable service which is built on the complete REST architecture. Restful web service focuses API from the application to a secure, uniform, stateless manner to the calling client who can perform predefined operations by using Restful services. The protocol for REST is HTTP. REST is called as Representation State Transfer.
Restful elements are:
REST Web services has way since its inception. In 2002, the web consortium had launched definition of WSDL and SOAP services.It can be formed the standard of how web services are implanted.
REST is considered as a way to access resources which lie in the particular environment. For example it could have server which will be hosting important documents or may be videos. If customer wishes web browser needs any of these resources.
The main key elements are
- Resources- The first element is resource. Consider an example of any web application on a server which has record of several employees. Consider an URL of the application which is http://demo.ggo.com to access this an employee record resource through the REST services one will issue command as http://demo.ggo.com/employee/1 mainly this command asks us web server to please provide the details of the employee whose number is 1.
- Request verbs- These will explain what you want to do with the resource.A browser issues a GET verb to instruct the endpoint it wants to get data. Many verbs available including things like POST, PUT and DELETE. In case of the example http://demo.ggo.com/employee/1 the web browser is actually issuing a GET verb because it wants to get the details of the employee record.
- Request Headers- It is additional instructions sent in the request. It might define the type of response required or authorization details.
- Request Body-Data will be sent with a request. Data is normally sent in the request when the POST request is made to the REST web services. In a POST call, the client tells the REST web services that it wants to add resources to the server.
- Response Body- This is the main body of the response.So the Restful API example, if it were a query the web server through their request http://demo.ggo.com/employee/1,the web server which might return an XML document having all the details of the employee in the response body.
- Response status codes- These codes will be general codes which are returned along with response from the web server.
When any client makes any request to web service,it can specify any normal HTTP verbs like GET, POST, DELETE and PUT. What will happen if the respective verbs are sent by the client.
- PUT- It creates a new employee using the Restful web service.
- GET- It gets a list of all employees using the Restful web service.
- PUT- It updates all employees using the Restful web service.
- DELETE-It is used to delete all employees using a Restful services.
The actions will have their respective meanings
- POST-This is not applicable since we are fetching data the employee 1 which has created.
- GET-This will be used to get the details of the employees with the employee no 1 who has the Restful web services.
- PUT-Can be used for updating the details of the employee with employee 1 using the Restful web service.
- DELETE-It deletes the details of the employees with the employee 1
REST API is also known as application programming interface that conforms to the constraints of REST architectural style and also allows for interaction with RESTful web services.
An API is a set of definitions and also protocols for building and integrating application software. It’s sometimes referred to as contract between an information provider and also information user.
1. What is RESTful services?
2. What are the features of RestFull services?