Skip to main content

Best practices on Naming APIs

Assigning identities

Ossi Galkin avatar
Written by Ossi Galkin
Updated over a year ago

Naming APIs

As Frends provides state of the art capabilities in building REST APIs, it is suggested to use the best practices of REST API naming.

API Titles

An API Title is the actual name of the API and should be descriptive and short enough while ending in "API". When setting up the URL or basepath, set it in the form of /api/yourtitle/version.

API Resources

In REST, the data is represented as a singleton or a collection resource.

The hierarchical relationships of these resources should be indicated with a forward slash (/) and trailing forward slashes should not be used in URIs. For instance, in:

/api/yourtitle/version/parentresource/childresource

the relationship is indicated with slashes and the childresource doesn't have a trailing forward slash. If you need to improve the readability of the URIs, use only hyphens (-) and not underscores (_). API resources should also be named using lowercase letters and without any file extensions. When HTTP methods in APIs are used properly, there is no need to use CRUD functions in names as they are indicated with the HTTP methods.

Did this answer your question?