Modify compress setting configurations.
| 파라미터 이름 | 설명 |
|---|---|
domain-nameString | The domain whoes need query config. |
| 파라미터 이름 | 설명 |
|---|---|
*compression-settingsObject | Compress setting config |
compression-enabledString | To enable compress setting, allowed true or false. |
br-typesString | Use br compression.The allowed values are true and false. |
specify-url-patternString | Specify URI |
custom-file-typesList | Custom file type: In addition to the specified file type, fill in the appropriate recognizable file type according to your own needs. It can be used in conjunction with uri-file-types. If uri-file-types is also configured, the actual effective file type is the sum of the two input parameters. |
file-typesList | Define the MIME file types to be compressed. 'text/' will be compressed by default. |
ignore-letter-caseString | Whether to ignore letter case. |
path-patternString | The url matching mode. If all matches, the input parameters can be configured as: .* |
custom-patternString | Specify Regular Pattern.The allowed values are homepage and all. |
uri-file-typesList | File type: Specifies the type of file to cache. File types include: gif png bmp jpeg jpg html htm shtml mp3 wma flv mp4 wmv zip exe rar css txt ico js swf If you need all types, simply pass all. Multiple types are separated by semicolons; all and specific file types cannot be configured at the same time. |
directoryString | Directory |
file-type-othersList | Another way to specify the file type to open the compressed response, and configuration will be cleared when input empty. |
| 파라미터 이름 | 설명 |
|---|---|
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 labeled id for querying each requested task (for all interfaces) |
messageString | Response information, when success is successful |
| 에러 코드(code) | 설명(message) | HTTP 상태 코드 | 설명 |
|---|---|---|---|
| NoSuchDomain | The specified domain does not exist.\n\n | 404 | The specified domain does not exist.\n\n |
| CustomerNoOwnDomain | customer not own domain name[www.example.com].\n\n | 400 | customer not own domain name[www.example.com].\n\n |
| ConfigError | The config {0} does not access.\n\n | 400 | The config {0} does not access.\n\n |
| InvalidParameter | example: 1. No domain was specified.2.The {0} is invalid.\n\n | 400 | example: 1. No domain was specified.2.The {0} is invalid.\n\n |
#!/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://api.cdnetworks.com/api/config/compresssetting/123344" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '
{
"compression-settings":{
"compression-enabled":"true",
"path-pattern":"*",
"ignore-letter-case":"true",
"file-types":[ "image/jpeg", "application/" ],
"uri-file-types":[ "mp3", "zip" ],
"custom-file-types":[ "json", "wasm" ],
"custom-pattern":"homepage",
"directory":"/directory/",
"specify-url-pattern":"/abc/.*",
"br-types":"true"
}
}'HTTP/1.1 202 Accepted
Server: openresty/1.11.2.2
Date: Mon, 27 May 2019 07:15:49 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 31
Connection: keep-alive
App-Name: service_confApi
x-cnc-request-id: 90d3b33c-3931-4436
{
"message":"success",
"code":""
}