Medium
Api
Version your APIs
Official
Rule Description
Include version in your API URLs or headers:
- URL versioning: `/api/v1/users`
- Header versioning: `Accept: application/vnd.api+json; version=1`
This allows you to:
- Make breaking changes without affecting existing clients
- Gradually migrate clients to new versions
- Deprecate old versions with advance notice
```ruby
# Rails routes
namespace :api do
namespace :v1 do
resources :users
end
namespace :v2 do
resources :users
end
end
```
Included in Rulesets
Add This Rule
Sign in to add this rule to your workspace
Sign in with GitHubDetails
- Severity
- Medium
- Category
- Api
- Used in
- 6 rulesets