Best Practices for Naming REST API URIs: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 1: Line 1:
=Internal=
=Internal=
* [[REST_and_Hypermedia#Endpoint|REST and Hypermedia]]
* [[REST_and_Hypermedia#Endpoint|REST and Hypermedia]]
=Use Nouns to Name URIs=
A REST API endpoint has a URL at which it can be accessed: https://example.com. Subdirectories of the URL denote different resources, which are accessed with URIs.
In general, URIs should be named with nouns that specify the content of the resource, rather than using a verb for the function performed. This is because CRUD operations should already be specified in the HTTP request.
Example:
https://example.com/users
https://example.com/user/{id}


=TODO=
=TODO=

Revision as of 00:02, 14 February 2024

Internal

Use Nouns to Name URIs

A REST API endpoint has a URL at which it can be accessed: https://example.com. Subdirectories of the URL denote different resources, which are accessed with URIs.

In general, URIs should be named with nouns that specify the content of the resource, rather than using a verb for the function performed. This is because CRUD operations should already be specified in the HTTP request.

Example:

https://example.com/users

https://example.com/user/{id}

TODO