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
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceId | Integer | Mandatory | The unique identifier of the service. |
| policyId | Integer | Mandatory | The unique identifier of the redirection policy. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| policyName | String | Mandatory | Name of the redirection policy. |
| matchUrlPath | Object | Mandatory | URL path matching configuration that determines which requests the rule applies to. See Match Url Path for details. |
| matchQueryString | Object | Optional | Query-string matching configuration used to refine which requests the rule applies to. See Match Query String for details. |
| redirectDestination | String | Mandatory | The destination URL to redirect to when the policy matches. |
| httpCode | Integer | Mandatory | HTTP status code for the redirect. Supported values: 301, 302. |
| priority | Integer | Mandatory | Priority weight for the rule. Rules with a higher weight take precedence. Must be a positive integer. |
| enabled | Boolean | Optional | Whether the policy is active. Default is true. |
Object: Match Url Path
| Parameter | Type | Required | Description |
|---|---|---|---|
| operator | String | Mandatory | Defines how to match the URL path. Supported values: prefix, regex, equals, suffix. |
| patterns | Array | Mandatory | List of patterns to match against the URL path. |
Object: Match Query String
| Parameter | Type | Required | Description |
|---|---|---|---|
| operator | String | Mandatory | Defines how to match the query string. Supported values: prefix, regex, equals, suffix. |
| patterns | Array | Mandatory | List of patterns to match against the query string. |
Response
Response Body
| Parameter | Type | Description |
|---|---|---|
| policyId | Integer | Policy ID number for redirection. |
| policyName | String | Name of the redirection policy. |
| matchUrlPath | Object | URL path matching configuration that determines which requests the rule applies to. See Match Url Path for details. |
| matchQueryString | Object | Query-string matching configuration used to refine which requests the rule applies to. See Match Query String for details. |
| redirectDestination | String | The destination URL to redirect to when the policy matches. |
| httpCode | Integer | HTTP status code for the redirect. Supported values: 301, 302. |
| priority | Integer | Priority weight for the rule. Rules with a higher weight take precedence. Must be a positive integer. |
| enabled | Boolean | Whether the policy is active. Default is true. |
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 | InvalidRedirection.PolicyName | Policy name is required. |
| 400 | InvalidRedirection.MatchURLIncorrect | The matches configuration cannot be empty. |
| 400 | InvalidRedirection.Operator | Operator must be one of the following values: prefix, regex, equals or suffix. |
| 400 | InvalidRedirection.MatchUrlPathPatternsIncorrect | Match patterns cannot be empty. |
| 400 | InvalidRedirection.URLEmpty | Redirect destination URL is empty. |
| 400 | InvalidRedirection.HttpCodeEmpty | HTTP status code is empty. |
| 400 | InvalidRedirection.HttpCode | HTTP status code must be 301 or 302. |
| 400 | InvalidRedirection.Priority | Policy 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
}