mardi 8 février 2022

REST API resource naming suffix

Our project came into discussion about URI pattern for Rest API.

The basic idea is a better description / readability of the endpoints themselves, by adding CRUD elements practically as a suffix in the endpoint name.

  • CRUD as /api/.../create, /api/.../read, /api/.../update and /api/.../delete endpoint pattern

So, examples (different examples without consistency for one project):

- GET    /api/v1/endpoint-names/read
- GET    /api/v1/endpoint-names/read/{id}
- GET    /api/v1/endpoint-names/read-paginated/{pageId}
- POST   /api/v1/endpoint-names/create
- PUT    /api/v1/endpoint-names/update-by-id/{id}
- DELETE /api/v1/endpoint-names/delete/{id}

I am aware of some recommendations, but I am interested in additional naming conventions / suggestions for web services with more complicated URI structures.

Or there is no real need for something like this?

Aucun commentaire:

Enregistrer un commentaire