Naming Conventions
This document describes API naming conventions related to services and resources, with focus on the general consumer experience. Consistency and clear naming conventions are key to providing uniform APIs between agencies. For further information about our naming conventions for the developer experience please refer to our coding standard.
General
In order to provide a consistent consumer experience across the API ecosystem and over a long period of time, all names used by an API should be:
simple
intuitive
consistent
One goal of these naming conventions is to ensure that the majority of consumers can easily understand an API. It does this by encouraging the use of a simple, consistent and small vocabulary when naming methods and resources. It also enforces names to be in British English. Developers should use our glossary when in trouble finding the appropriate English translation of an Icelandic concept.
Commonly accepted short forms or abbreviations of long words may be used for brevity. For example, API is preferred over Application Programming Interface. Use intuitive, familiar terminology where possible. For example, when describing removing (and destroying) a resource, delete is preferred over erase. Use the same name or term for the same concept, including for concepts shared across the ecosystem.
Name overloading should be avoided. Use different names for different concepts. Overly general names that are ambiguous within the context of the API and the larger API ecosystem should be avoided as they can lead to a misunderstanding of API concepts. Specific names that accurately describe the API concept and distinguish it from other relevant concepts should be used. There is no definitive list of names to avoid, as every name must be evaluated in their context.
Bad
Good
Carefully consider using names that may conflict with keywords in common programming languages. Such names may be used but will likely trigger additional scrutiny during API review. Use them judiciously and sparingly.
Resources
Resource names should be singular noun
and use PascalCase
.
Bad
Good
URIs
The URI defined in RFC3986 consists of five components: scheme, authority, path, query and fragment.
When structuring resource URIs please follow the following rules:
[Resource names and collection IDs] must be the plural form of the singular noun used for the resource.
Use lowercase letters for URI paths since capital letters can sometimes cause problems.
Use hyphens (
-
) to improve readability of concatenated resource names.Use the forward slash (
/
) in a path to indicate hierarchical relationship between resources.Do not end a path with a trailing forward slash (
/
).Do not use underscores (
_
) as they can be partially obscured or hidden in some browsers or screens.For naming query parameters please use the camelCase naming convention.
Example URI of an authority and a path component
Fields
Resource field names should be clear, descriptive and use camelCase
. Fields representing arrays or lists should be named as plural nouns.
Bad
Good
References
Last updated