-
Notifications
You must be signed in to change notification settings - Fork 0
Description
API Versioning
What needs to change:
In the past, APIs have been versioned as a whole where the version encompasses all of the endpoints. This leads to a monolithic view of the API preventing it from being more composable. Changes in one resource require bumping the global API version. There is potential for more frequent version churn. We should move away from versioning the entire API.
What do you propose?
Versioning will be done on a resource basis. Each resource-collection will be versioned as opposed to the entire API being versioned. This composability allows changes to individual resources without affecting the remainder of the API.
The version will precede the resource-collection. The URI syntax is as follows:
/api-group/version/resource-collection/
Examples:
GET /storage/v1/storage-systems
GET /storage/v2/storage-systems
The Google AIP-185 API Versioning puts the major version number in the URI. The use of the term "major version number" is taken from semantic versioning at semver.org. However, unlike in traditional semantic versioning, Google APIs must not expose minor or patch version numbers. For example, Google APIs use v1, not v1.0, v1.1, or v1.4.2. From a user's perspective, major versions are updated in place, and users receive new functionality without migration. For this reason, this RFD suggests only using the major version number in the URL.
When incrementing the version on a resource-collection, the sunset HTTP header field could be used to indicate when a resource-collection is being deprecated.
See this standard for IETF RFC 8594 The Sunset HTTP Header Field.
What alternatives exist?
The version could be specified in the request HEADER.
Example: GET /users with header Accept: application/vnd.myapi.v2+json
Pros:
• Clean URLs.
• Can support multiple representations or minor variations.
• Encouraged in REST-style APIs.
Cons:
• Harder for humans to discover.
• Not cache-friendly.
• Poor support in some tools or proxies.
This Github API Versions document describes an alternate method for supplying the version in the header.
Related RFDs
- Establishment of an API contract specification for OpenCHAMI
- This RFD should be part of the API contract specification.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status