Content Acceleration,Dynamic Web Acceleration,Media Acceleration VoD,Media Acceleration Live Broadcast
Self-service through interface, url redirection function
Single user trigger frequency: 300/5min
| Name | Description |
|---|---|
*domain-nameString | the domain whoes need query config |
| Name | Description |
|---|---|
*rewrite-rule-settingsList | redirection function
note:
1. Define a set of internal redirected content. If there is internal redirected content, this field is required.
2. need to clear the content redirection content under the domain name, you can pass the empty node |
after-valueString | Configuration item: new url
Indicates the protocol method after rewriting, such as: http://$1 |
file-typeString | gif png bmp jpeg jpg html htm shtml mp3 wma flv mp4 wmv zip exe rar css txt ico js swf m3u8 xml f4m bootstarp ts |
custom-file-typeString | Matching condition: Custom file type, please separate them by semicolon. |
operators-areaString | Region |
ignore-letter-caseString | Ignore case, the optional value is true or false, true means to ignore case; false means not to ignore case;
When adding a new configuration item, the default is not true.
If the client passes a null value: such as |
exceptional-operators-areaString | Exceptional region |
exceptional-requestString | Exceptional Request Method |
path-patternString | The url matching mode supports fuzzy regularization. If all matches, the input parameters can be configured as: |
custom-patternString | Matching conditions: specify common types, optional values are all or homepage 1. all: all files 2. homepage: home page |
request-wayString | Request Method |
priorityString | Indicates the priority execution order of multiple sets of redirected content by the customer. The higher the number, the higher the priority.
When adding a new configuration item, the default is 10 |
uaString | UA |
directoryString | directory |
rewrite-typeString | Redirection type; support for input:
before: before the anti-theft chain
after: after the anti-theft chain |
publish-typeString | Rewrite the location where the content is generated. The input value is: Cache indicates the node;
Other input formats are not supported at this time |
exception-request-headerString | Matching condition: Exception request header |
exceptional-uaString | Exceptional UA |
request-headerString | Matching condition: Request header |
data-idLong | Add a grid type identifier to indicate a specific group configuration when the client has multiple groups of configurations. |
except-path-patternString | Exceptional url matching mode, except for certain URLs: such as abc.jpg, no content redirection
Customer reference: ^https?://[^/]+/.*\.m3u8 |
before-valueString | Configuration item: old url
Indicates the protocol mode before rewriting (that is, the object that needs to be rewritten), such as: ^https://([^/]+/.*) |
descriptionString | description |
| Name | Description |
|---|---|
codeString | The error code, when HTTPStatus is not 202, indicates the type of error the current request is calling. |
httpStatusInteger | httpstatus=202; Indicates that the new domain API was successfully invoked, and the current deployment of the new domain can be viewed using x-cnc-request-id in the header |
x-cnc-request-idString | Uniquely identified id for querying tasks per request (for all API) |
messageString | Response information, when success is successful |
| Error code(code) | Description(message) | HTTP status | Semantic |
|---|---|---|---|
| InvalidParameter | The url-pattern can't be empty. | 400 | The url-pattern can't be empty. |
| InvalidParameter | The publish-type can't be empty. | 400 | The publish-type can't be empty. |
| InvalidParameter | The before-value can't be empty. | 400 | The before-value can't be empty. |
| InvalidParameter | The after-value can't be empty. | 400 | The after-value can't be empty. |
| InvalidParameter | The rewrite-type can't be empty. | 400 | The rewrite-type can't be empty. |
| InvalidParameter | No rewrite-rule-settings was specified. | 400 | No rewrite-rule-settings was specified. |
| InvalidParameter | No domain was specified. | 400 | No domain was specified. |
| InvalidParameter | The ignore-letter-case is invalid. | 400 | The ignore-letter-case is invalid. |
| InvalidParameter | The publish-type is invalid. | 400 | The publish-type is invalid. |
| InvalidParameter | The priority is invalid. | 400 | The priority is invalid. |
| InvalidParameter | The rewrite-type is invalid. | 400 | The rewrite-type is invalid. |
| InvalidParameter | The path-pattern is required. | 400 | The path-pattern is required. |
| InvalidParameter | The publish-type is required. | 400 | The publish-type is required. |
| InvalidParameter | The before-value is required. | 400 | The before-value is required. |
| InvalidParameter | The after-value is required. | 400 | The after-value is required. |
| InvalidParameter | The rewrite-type is required. | 400 | The rewrite-type is required. |
| InvalidParameter | The request has null config with null data-id, please remove it. | 400 | The request has null config with null data-id, please remove it. |
| NoSuchDomain | The specified domain does not exist. | 404 | The specified domain does not exist. |
| InternalError | We encountered an internal error. Please try again. | 500 | We encountered an internal error. Please try again. |
| ConfigError | The config {0} does not access. | 400 | The config {0} does not access. |
| CustomerNoOwnDomain | customer not own domain name. | 400 | customer not own domain name. |
| WrongDataId | Wrong data-id. | 400 | Wrong data-id. |
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://{@apiDomain}/api/config/InnerRedirect/123344" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '{
"rewrite-rule-settings": [
{
"data-id": "31506537",
"path-pattern": ".*",
"except-path-pattern": "^https?://[^/]+/.*.m3u8",
"ignore-letter-case": "true",
"publish-type": "Cache",
"priority": "10",
"before-value": "^http://([^/]+/.*)",
"after-value": "https://$1",
"rewrite-type": "before",
"request-way":"POST;PUT",
"exceptional-request":"Purge",
"ua":"iPhone",
"exceptional-ua":"iPad",
"operators-area":"Asia_East",
"exceptional-operators-area":"Asia_South"
},
{
"path-pattern": ".*",
"except-path-pattern": "^https?://[^/]+/.*.m3u8",
"ignore-letter-case": "true",
"publish-type": "Cache",
"priority": "9",
"before-value": "http",
"after-value": "https",
"rewrite-type": "before"
}
],
"description":"description"
}'HTTP/1.1 202 Accepted
Date: Fri, 17 May 2017 06:33:26 GMT
Content-Type: application/json;charset=utf-8
x-cnc-request-id:c54cbbb4-19fe-407a-930c-3988b62ed2fd
{"message":"success"}