Verbs Flashcards
GET
Fetches a record or set of resources from the server
Success: 200
Failure: 404
OPTIONS
Fetches all available REST operations
Success: 200
POST
Creates a new set of resources or a resource on a server
Success: 201
Failure: 404, 409
PUT
Updates or replaces the given record.
If a resource does not exist, create one.
PUT is idempotent.
Success: 200, 204
Failure: 404
PATCH
Modifies the given record.
PATCH won’t replace the whole record, it only patches the modified column.
Success: 200, 204
Failure: 404
DELETE
Delete the given record
Success: 200
Failure: 404
GET: Query Parameters
Intended to add detailed information to identify a resource from the server.
ex: /v1/books/?category=fiction&publish_date=2017
GET: Path-based Parameters
The resource query is with the path.
ex: /v1/payments/billing-agreements/agreement_id
Query vs Path Parameters
Query parameters should be used to fetch multiple resources based on the query parameters.
A single resource with exact URI information can use Path Parameters.
POST vs PUT
POST creates two instances with the same data
PUT updates a single resource that already exists