API Throttling
CNH API support throttling to limit the number of API requests a system can process at a given time.
Rate-Limit Throttling
This type of throttling is used for incoming requests.
Example
The following policy restrict API endpoints for 120 calls every second:
<rate-limit calls="120" renewal-period="1"/>
When the limit of 120 calls per a second is reached, the API will send a HTTP status code of 429 Too many requests
.
The response includes a Retry-After value, which specifies the number of seconds a calling application should wait (or sleep) before sending the next request. If the calling application sends a request before the retry value has elapsed, its request will not be processed and a new retry value will be returned.
The response JSON will contain the following:
{
"error": {
"code": 429,
"message": "Rate limit is exceeded. Try again in 1 seconds."
}
}
The response header will contain the following:
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Content-Length: 83
Retry-After: 1
Request-Context: appId=cid-v1:e74f7c32-8e31-4289-92fd-53b02c13017e
Date: Mon, 30 May 2022 11:46:45 GMT