Skip to content
Fernando Benjamin edited this page Jan 14, 2020 · 3 revisions
HTTP Method Idempotent Safe
OPTIONS yes yes
GET yes yes
HEAD yes yes
PUT yes no
POST no no
DELETE yes no
PATCH no no

Which operations to use?

POST vs PUT

What would happen if you sent out the POST request to the server, but you get a timeout. Is the resource actually updated? Does the timeout happened during sending the request to the server, or the response to the client? Can we safely retry again, or do we need to figure out first what has happened with the resource? By using idempotent methods, we do not have to answer this question, but we can safely resend the request until we actually get a response back from the server.

HTTP Error Codes

CODE 400 - BAD REQUEST
  • When required parameters for executing the operation succesful are missing.
CODE 404 - NOT FOUND
  • Resource was not found.

Resource - Can be a singleton or a collection like /Customersor `/Customers/{customerId}

Nouns - Identify low level resources like openan Account or closean Account.

Rest in practice

Chapter 4

POST or PUT?

  • Use POST to create a resource identified by a service-generated URI.
  • Use POST to append a resource to a collection identified by a service-generated URI.
  • Use PUT to create or overwrite a resource identified by a URI computed by the client.

How to handle bulk Operation
Belgian Bank Rest API Resource

Clone this wiki locally