IMPORTANT! The information on this page is unverified and unsupported. Always double-check the accuracy of the solutions provided. Evaluate and test the impact on any environments!
Swagger - How to Apply a Different API Throttling Configuration to a Certain Endpoint?
Description
Is it possible to apply a specific API Throttling configuration only to certain endpoints?
For example:
- A very large number of calls per seconds/minute to endpoints /api/v3/items/query and /api/v3/items/{itemId}/fields, AND
- The standard API throttling default values to all other endpoints.
Observed on
- codebeamer 21.09-LTS (EMMA)
Solution
To cover the above example, use the following configuration in Application Configuration:
"apiThrottling" : [
{
"days" : "MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY",
"urlPatterns" : "/api/v3/items/query?**, /api/v3/items/**/fields**",
"bandwidthConfigs" : [
{
"capacity" : 1000,
"timeUnit" : "SECOND"
},
{
"capacity" : 10000,
"timeUnit" : "MINUTE"
}
]
},
{
"urlPatterns" : "/rest/**, /api/**",
"bandwidthConfigs" : [
{
"capacity" : 3,
"timeUnit" : "SECOND"
},
{
"capacity" : 120,
"timeUnit" : "MINUTE"
}
]
}
]
The above provided values for bandwidthConfigs.capacity are examples. Always evaluate and test any values before applying to them to any environments.
Explanation - by providing:
"days" : "MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY"
the specificity of the rule is increased, leading codebeamer to handle those as separate endpoints (although, partly matching the default urlPatterns) and apply different rules.
For any other Support options, questions, or inputs, visit: https://intland.com/technical-support/