By this post I will introduce you about Rest Services.
REST is the acronym for REpresentational State Transfer.It is used to develop wide variety of application used over the different types of networks.
HTTP verbs
Below are the HTTP methods which are used in REST architecture
- GET − Used to fetch resources
- POST − Used to insert a new resource.
- DELETE − Used to remove a resource.
- PUT − Used to replace a new resource.
- OPTIONS − Used to get all options that are allowed.
- HEAD − Used to get the requested header
REST architecture based web services which identified by their URIs. Client applications uses HTTP GET and POST methods.These methods will invoke Restful services called upon.
This is reflected as a subsititution which came over SOAP web services.Main advantage of this was, it is light weighted and no strict standards to follow.
Both JSON and XML data types used for requests and responses.
Below is an example of creating RESTful web service
POST
- http://www.afsliit.com/students
This POST request is used to create a new resource student in the system.
GET
- http://www.afsliit.com/students/1234
This GET request is used to get the data of student of ID 1234.
- http://www.afsliit.com/students/2312
This PUT request is used to update the data of student of ID 2312.
DELETE
- http://www.afsliit.com/lecturer/eT45w2
This DELETE request is used to delete the data of lecturer of code eT45w2.
Let's meet again with another exiting post.Happy coding :)
©Copyright Viraj Wickramasinghe.
No comments:
Post a Comment