Skip to content

Commit

Permalink
general/api: Move endpoint style from Credere backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Aug 15, 2024
1 parent c8ec314 commit f3c36a0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/general/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,30 @@ Follow best practices for authoring APIs. Some tips:
.. seealso::

OCDS documentation `API access <https://standard.open-contracting.org/latest/en/guidance/build/hosting/#api-access>`__ guidance

Endpoint names
~~~~~~~~~~~~~~

Use lowercase letters and separate words with hyphens or underscores.

Example: GET /users or GET /users/all

If the endpoint retrieves a specific resource, use the resource name in its singular form.

Example: GET /user/{id} or PUT /user/{id}

For endpoints that return collections of resources, use plural nouns.

Example: GET /users or POST /users

Use sub-resources to represent relationships between resources.

Example: GET /users/{id}/orders or GET /users/{id}/invoices

For actions or operations that do not fit into the RESTful resource model, consider using verbs or descriptive phrases.

Example: POST /users/{id}/reset-password or PUT /users/{id}/activate

Avoid using abbreviations or acronyms unless they are widely understood and agreed upon within your development team or industry.

Ensure that the endpoint names are self-explanatory and reflect the purpose of the API operation.

0 comments on commit f3c36a0

Please sign in to comment.