Skip to main content

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​

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryThe unique identifier of the service.

Body Parameters​

ParameterTypeRequiredDescription
timeWindowIntegerMandatoryTime window for rate limiting (in seconds). Must be a positive integer.
requestLimitIntegerMandatoryMaximum number of requests allowed from the same client IP within the specified time window. Must be a positive integer
ignoreUrlPathBooleanOptionalIgnore 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.
ignoreQueryStringBooleanOptionalIgnore 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 CodeError CodeError Message
400Request.BadRequestBad request.
400InvalidCustomer.IdEmptyCustomer ID cannot be empty or invalid.
400InvalidService.IdIncorrectService ID is empty or invalid.
400InvalidService.IdPermissionService ID cannot be found or unknown.
400InvalidRateLimit.TimeWindowInvalid time window value. Must be a positive integer.
400InvalidRateLimit.RequestLimitInvalid 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