Skip to main content

Edit Redirection

This API is used to edit an existing redirection rule for a website acceleration service.

Request

Request-Line

PUT /cdn/v1.0/services/{serviceId}/redirections/{policyId} HTTP/1.1

Request Parameters

Path Parameters

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryThe unique identifier of the service.
policyIdIntegerMandatoryThe unique identifier of the redirection policy.

Body Parameters

ParameterTypeRequiredDescription
policyNameStringMandatoryName of the redirection policy.
matchUrlPathObjectMandatoryURL path matching configuration that determines which requests the rule applies to. See Match Url Path for details.
matchQueryStringObjectOptionalQuery-string matching configuration used to refine which requests the rule applies to. See Match Query String for details.
redirectDestinationStringMandatoryThe destination URL to redirect to when the policy matches.
httpCodeIntegerMandatoryHTTP status code for the redirect. Supported values: 301, 302.
priorityIntegerMandatoryPriority weight for the rule. Rules with a higher weight take precedence. Must be a positive integer.
enabledBooleanOptionalWhether the policy is active. Default is true.
Object: Match Url Path
ParameterTypeRequiredDescription
operatorStringMandatoryDefines how to match the URL path. Supported values: prefix, regex, equals, suffix.
patternsArrayMandatoryList of patterns to match against the URL path.
Object: Match Query String
ParameterTypeRequiredDescription
operatorStringMandatoryDefines how to match the query string. Supported values: prefix, regex, equals, suffix.
patternsArrayMandatoryList of patterns to match against the query string.

Response

Response Body

ParameterTypeDescription
policyIdIntegerPolicy ID number for redirection.
policyNameStringName of the redirection policy.
matchUrlPathObjectURL path matching configuration that determines which requests the rule applies to. See Match Url Path for details.
matchQueryStringObjectQuery-string matching configuration used to refine which requests the rule applies to. See Match Query String for details.
redirectDestinationStringThe destination URL to redirect to when the policy matches.
httpCodeIntegerHTTP status code for the redirect. Supported values: 301, 302.
priorityIntegerPriority weight for the rule. Rules with a higher weight take precedence. Must be a positive integer.
enabledBooleanWhether the policy is active. Default is true.

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.
400InvalidRedirection.PolicyNamePolicy name is required.
400InvalidRedirection.MatchURLIncorrectThe matches configuration cannot be empty.
400InvalidRedirection.OperatorOperator must be one of the following values: prefix, regex, equals or suffix.
400InvalidRedirection.MatchUrlPathPatternsIncorrectMatch patterns cannot be empty.
400InvalidRedirection.URLEmptyRedirect destination URL is empty.
400InvalidRedirection.HttpCodeEmptyHTTP status code is empty.
400InvalidRedirection.HttpCodeHTTP status code must be 301 or 302.
400InvalidRedirection.PriorityPolicy is empty or invalid.

Examples

Edit Redirection

Request

PUT /cdn/v1.0/services/228657/redirections/261957  HTTP/1.1

{
"policyName":"redoxxx",
"matchUrlPath":{
"operator":"suffix",
"patterns":["/"]
},
"matchQueryString":{
"operator":"prefix",
"patterns":["/"]
},
"priority":1,
"redirectDestination":"www.domainmm.com",
"httpCode":302,
"enabled":true
}

Successful Response Body

{
"policyId": 261957,
"policyName": "redoxxx",
"redirectDestination": "www.domainmm.com",
"httpCode": 302,
"matchUrlPath": {
"operator": "suffix",
"patterns": [
"/"
]
},
"matchQueryString": {
"operator": "prefix",
"patterns": [
"/"
]
},
"priority": 1,
"enabled": true
}