Understanding the basics of REST
Representational State Transfer (REST) is a software architecture for building web services. REST communicates over HTTP using the HTTP verbs GET
, POST
, PUT
, and DELETE
. REST operations involve resources and the HTTP verbs indicate what actions to perform. The following sections describe the HTTP verbs in combination with REST and demonstrate some typical operations. The four above-mentioned verbs are sufficient to perform all the CRUD operations we need in modern systems.
Check out the following table to see the differences between the verbs and some examples:
Verb |
Operation |
Happy flow |
Unhappy flow |
---|---|---|---|
|
Creates a resource |
201 created |
404 not found or 409 conflict when item already exists |
|
Gets a resource |
Returns a list of all devices |
Returns a specific device or 404 not found if the device does not exist |
|
Updates a resource |
Potentially updates the complete collections of... |