Restful Services
Sraban Pahadasingh April 14, 2020 05:53 PM# Why REST
- Rest can be fetched from cahced storage instead of always heating to Server
- Rest is Stateless.
- Rest can work in very low bandwidth
- REST request & response can be in TEXT, XML, HTML and JSON Format.
- REST is an architectural pattern not a protocal.
- REST can make use of SOAP services.
- Challenges in Rest - Lack of Security & Lack of state
# Methods:
-
GET
- This method is like calling a uri with query parameters.
-
POST
- Not idempotent method, used to create records in DB
- Since record does not exits before, save url and return url is different.
-
PUT
- This method is idempotent. means client and server urls are same.
- Used for updating a resource by using the primary key.
- This method specifiy to fully update the db record with the variables.
- When the the url with primary key is not valid, the record is auto generated in database.
-
PATCH
- This method is idempotent. means client and server urls are same.
- Used for updating a resource by using the primary key.
- This method specifiy to partially update the db record.
- When the the url with primary key is not valid, the record is auto generated in database.
- DELETE
- This method in REST is used to destroy the resource.
- Destroyed resource are not called again To DELETE the resource