Tags:
not added yet
API Throttling
Table of Contents
Default valueBy default API throttling is activated with the following configuration: "apiThrottling": [ { "urlPatterns": "/rest/**, /api/**", "bandwidthConfigs": [ { "capacity": 3, "timeUnit": "SECOND"}, { "capacity": 120, "timeUnit": "MINUTE"} ] } ]
Please note the API calls from word export and RPE server are not blocked by API throttling. How to disable API throttling
In codebeamer, the API throttling can be disabled in two ways:
1. Through Application configuration, in the System Admin ► Application Configuration menu, by adding the below line to the main JSON object: "apiThrottling" : false
The CB_apiThrottling=false environment variable takes precedence over any other settings on Application Configuration.
How to set up API throttlingAPI throttling configuration must be added to the Application Configuration as a new JSON node. Upon saving the configuration the system runs a validation against the following rules:
If the validation fails against any of the rules, an error message is displayed and the Application Configuration cannot be saved.
Format"apiThrottling": [ { "urlPatterns": "[URL PATTERN, URL PATTERN...]", "serverIds": "[SERVER ID PATTERN, SERVER ID PATTERN...]", "days": "[DAY OF WEEK]", "groups": "[USER GROUP ID, USER GROUP ID...]", "users": "[USER ID, USER ID...]", "synchronizedLock": true / false, "timeWindows" : [ { "from" : "HH:mm", "to" : "HH:mm" }, { "from" : "HH:mm", "to" : "HH:mm" }, ... ], "bandwidthConfigs": [ { "capacity": CAPACITY, "timeUnit": "TIMEUNIT"}, { "capacity": CAPACITY, "timeUnit": "TIMEUNIT"}, ... ] } ]
URL PatternsComma separated Ant path style patterns. Please note that the context path is not part of the pattern.
The mapping matches URLs using the following rules:
Examples
Server IdsComma separated JAVA regex patterns.
Examples
For more details please refer to the official java documentation: Java Regex Day of weekComma separated values Possible values: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
Group IDsComma separated values of ID of user groups
You can use the following SQL query in order to find the ID for a group select name, id from user_group order by name
User IDsComma separated values of ID of users
You can use the following SQL queries in order to find the ID for a user
Find user by name: select id from users where name = '<name>';
Find user by email address: select id from users where email = '<email>'; Synchronized lockTrue (default value)Blocking strategy based on java <code>synchronized</code> keyword.
FalseLock-free algorithm based on CAS(compare and swap) of immutable objects.
Time windows configurationA list of timeWindows objects. A time window object has a from and a to parameter, determining the time period when API throttling is in effect. The following validation rules apply to timeWindows objects:
If the validation fails against any of the rules, an error message is displayed and the Application Configuration cannot be saved.
FromA 24-hour timestamp in HH:mm format, determining the beginning of the time window. ToA 24-hour timestamp in HH:mm format, determining the end of the time window. ExamplesExample 1This configuration is in effect on Mondays, between 9:00-11:00 and 14:00-17:00: "apiThrottling": [ { "urlPatterns": "/project/*,/user/*", "days": "MONDAY", "groups": "3,4", "users": "1,2", "synchronizedLock" : true, "timeWindows" : [ { "from" : "09:00", "to": "11:00" }, { "from" : "14:00", "to": "17:00" } ], "bandwidthConfigs": [ { "capacity": 100, "timeUnit": "MINUTE" } ] } ] Example 2This configuration fails on validation, as there are overlapping time windows: "apiThrottling": [ { "urlPatterns": "/project/*,/user/*", "days": "MONDAY", "groups": "3,4", "users": "1,2", "synchronizedLock" : true, "timeWindows" : [ { "from" : "09:00", "to": "16:00" }, { "from" : "09:00", "to": "11:00" } ], "bandwidthConfigs": [ { "capacity": 10, "timeUnit": "DAY" } ] } ] Bandwidth configurationTime unitPossible values: DAY, HOUR, MINUTE, SECOND CapacityPositive number
It is a number of call that can happen during the given time unit.
ExampleCapacity is set to 5, time unit is MINUTE. It means that only 5 calls can happen in every minute. Please note the start and end of a minute is not bound to the server clock. In other words if the configuration is applied at 12h 00m and 30 seconds, 5 calls can happen between 12:00:30 and 12:01:30. Precedence of configuration - examplesPrecedence of rules depends on the number of parameters are set. If only one from the parameters (day, users, groups) is set the precedence is 1, if two then the precedence is 2, and so on. Always the rule with the highest precedence number are found and executed.
Example 1"apiThrottling": [ { "urlPatterns": "/project/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] }, { "urlPatterns": "/project/test/**", "bandwidthConfigs": [{ "capacity": 10, "timeUnit": "MINUTE"}] } ] Let's say that user one calls /project/test/example.spr 5 times and user two tries to call the /project/test2/example.spr but he will receive a TOO_MANY_REQUESTS (429) error Example 2"apiThrottling": [ { "users": "<ID of user one>" "urlPatterns": "/project/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] }, { "urlPatterns": "/project/test/**", "bandwidthConfigs": [{ "capacity": 10, "timeUnit": "MINUTE"}] } ] Let's say that user one calls /project/test/example.spr 5 times and user two tries to call the /project/test2/example.spr, user two can call the /project/test2/example.spr. It happens because the first rule has a higher precedence and it is only applied for user one, while the second rule is applied for every user. Example 3"apiThrottling": [ { "groups": "<ID of user groups contains user one>" "urlPatterns": "/project/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] }, { "urlPatterns": "/project/test/**", "bandwidthConfigs": [{ "capacity": 10, "timeUnit": "MINUTE"}] } ] Same result that in the previous example
Example 4"apiThrottling": [ { "days": "SATURDAY, SUNDAY", "users": "<ID of user one>", "urlPatterns": "/project/**", "bandwidthConfigs": [{ "capacity": 1, "timeUnit": "MINUTE"}] }, { "users": "<ID of user one>", "urlPatterns": "/project/test/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] } { "urlPatterns": "/project/test/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] } ] On Monday Same result that in the previous example, the first rule is not applied
On Sunday Let's say that user one calls /project/test/example.spr 2 times, first call is served by the codebeamer but the second call ends with TOO_MANY_REQUESTS (429) error. User two is able to call /project/test2/example.spr Example 5"apiThrottling": [ { "days": "SATURDAY, SUNDAY", "users": "<ID of user one>", "urlPatterns": "/project/**", "bandwidthConfigs": [{ "capacity": 1, "timeUnit": "MINUTE"}] }, { "days": "SUNDAY", "groups": "<ID of user groups contains user one and user two>" "urlPatterns": "/project/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] }, { "urlPatterns": "/project/test/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] } ] On Sunday Let's say that user one calls /project/test/example.spr 2 times, first call is served by the codebeamer but the second call ends with TOO_MANY_REQUESTS (429) error. User two is able to call /project/test2/example.spr. Example 6"apiThrottling": [ { "users": "<ID of user one>", "bandwidthConfigs": [{ "capacity": 1, "timeUnit": "MINUTE"}] }, { "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] } ] Example above is equivalent with the following "apiThrottling": [ { "users": "<ID of user one>", "urlPatterns": "/**", "bandwidthConfigs": [{ "capacity": 1, "timeUnit": "MINUTE"}] }, { "urlPatterns": "/**", "bandwidthConfigs": [{ "capacity": 5, "timeUnit": "MINUTE"}] } ] TOO_MANY_REQUESTSCodebeamer returns a TOO_MANY_REQUESTS (429) error code and a Retry-After header
Swagger changesSwagger API changes since 20.11-LTS
REST API |
Fast Links
codebeamer Overview codebeamer Knowledge Base Services by Intland Software |
This website stores cookies on your computer. These cookies are used to improve your browsing experience, constantly optimize the functionality and content of our website, furthermore helps us to understand your interests and provide more personalized services to you, both on this website and through other media. With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click accept to consent to our and our partners’ processing as described above. Please be aware that some processing of your personal data may not require your consent, but you have a right to object to such processing. By using our website, you acknowledge this notice of our cookie practices. By accepting and continuing to browse this site, you agree to this use. For more information about the cookies we use, please visit our Privacy Policy.Your preferences will apply to this website only.
Note that user-behavior analytics are being captured on this server for the purpose of improving the Codebeamer user experience.