reading-notes

CRUD

CRUD (Create, Read, Update, Delete)

The CRUD model defines the most basic API actions for persistent storage. Create, read, update, and delete.

CREATE

The create action is usually implemented via HTTPs POST method. In RESTful APIs, these endpoints are used to create new resources or access tokens.

Status Codes

READPermalink

The read action gets implemented via HTTPs GET method and used to fetch resource representations. Asynchronous responses aren’t much of a thing here, because the reason for asynchronous processing is often that the resource doesn’t exist yet and has to be created, so it’s a create action anyway.

Status Codes

UPDATE

An update can be implemented with an HTTP PUT or PATCH method. The difference lies in the amount of data the client has to send to the backend.

PUT requires the client to send an entire representation of a resource to update it. (Replace the old one with the new one)

PATCH requires the client only send parts of the representation of the resource to update it. (Add, update or delete these parts in the old version)

Status Codes

DELETE

The delete action can be implemented with the HTTP DELETE method.

Status Codes

API Changes

If our API lives long enough, sooner or later it will change its structure.

Status Codes

Errors

Wrong URL

When a client sends a URL, we don’t know. This can have multiple different reasons, so we have to check which of them applies here.

Status Codes

No Permissions

Often clients can’t access every resource on the backend, so we need a way to tell them about it.

Status Codes