Upsert Rate Limit
This API is used to create or update the rate limit configuration for a website acceleration service. If a rate limit configuration already exists for the service, it will be updated; otherwise, a new one will be created.
Request
Request-Line
POST /cdn/v1.0/services/{serviceId}/rateLimit HTTP/1.1
Request Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceId | Integer | Mandatory | The unique identifier of the service. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| timeWindow | Integer | Mandatory | Time window for rate limiting (in seconds). Must be a positive integer. |
| requestLimit | Integer | Mandatory | Maximum number of requests allowed from the same client IP within the specified time window. Must be a positive integer |
| ignoreUrlPath | Boolean | Optional | Ignore URLs, apply a single limit for all URLs from the same user IP. Default is false. If omitted on update, the current value will be retained. Default is false. |
| ignoreQueryString | Boolean | Optional | Ignore Query String when counting requests. Default is false. If omitted on update, the current value will be retained. Default is false. |
Response
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | Request.BadRequest | Bad request. |
| 400 | InvalidCustomer.IdEmpty | Customer ID cannot be empty or invalid. |
| 400 | InvalidService.IdIncorrect | Service ID is empty or invalid. |
| 400 | InvalidService.IdPermission | Service ID cannot be found or unknown. |
| 400 | InvalidRateLimit.TimeWindow | Invalid time window value. Must be a positive integer. |
| 400 | InvalidRateLimit.RequestLimit | Invalid request limit value. Must be a positive integer. |
Examples
Upsert Rate Limit
Request
POST /cdn/v1.0/services/228331/rateLimit HTTP/1.1
{
"timeWindow": 60,
"requestLimit": 10000000,
"ignoreUrlPath": true,
"ignoreQueryString": true
}
Successful Response Body
HTTP/1.1 200