HTTP Methods Flashcards
Understand HTTP Methods
1
Q
GET
A
- retrieve information
- must be safe and idempotent
- meaning regardless of how many times it repeats with the same parameters, the results are the same
- can have side effects, but the user doesn’t expect them, so they cannot be critical to the operation of the system
- requests can also be partial or conditional
2
Q
POST
A
- request that the resource at the URI do something with the provided entity
- often used to create a new entity, but it can also be used to update an entity
3
Q
PUT
A
- store an entity at a URI
- PUT can create a new entity or update an existing one
- PUT request is idempotent
- Idempotency is the main difference between PUT versus a POST request
- e.g. modify the address with an ID of 1
4
Q
PATCH
A
- update only the specified fields of an entity at a uri
- is neither safe nor idempotent
- because it cannot ensure the entire resource has been updated
5
Q
DELETE
A
- request that a resource be removed
- resource does not have to be removed immediately
- it could be an asynchronous or long-running request