UpdatetimecontrolService

Update time: 2026-08-25 10:26:09

Applicable Products

Content Acceleration,Dynamic Web Acceleration

API Description

Modify timestamp anti-theft chain custom configuration item content

Call frequency

Single user trigger frequency: 300/5min

Request parameter(s)

Path Params

NameDescription
*domainString
Domain ID or domain name.

Body Params

NameDescription
*timestamp-visit-control-ruleObject
path-patternString
The url matching mode supports fuzzy regularization. If all matches, the input parameters can be configured as:. Verify the time stamp of the matched URL for anti-leeching; reject URLs that are not matched.
except-path-patternString
Exceptional url matching mode, except for some URLs: such as abc.jpg, do not do anti-theft chain function
protocol-of-path-patternString
Optional values are: http, https, http;https, noprefix, empty. If it is empty, it defaults to "http;https"; if it is noprefix, it means that the protocol prefix of url is not specified, and it only matches according to the regularity of path-pattern. This configuration item only matches with path-pattern. example: 1. Specify protocol-of-path-pattern=https and path-pattern=.* to match all https requests, but not http requests. 2. Specify protocol-of-path-pattern=http;https, path-pattern=.* to match all http and https requests. 3. Specify protocol-of-path-pattern=noprefix and path-pattern=^http://[^/]+/.* to match all http requests but not https requests.
directoryString
Directory, multiple separated by English semicolons. Perform timestamp anti-leech verification for the matched directory; reject the unmatched directory. mutually exclusive with path-pattern.
allowed-ipsString
Exceptional IP, supports input of IP or IP range, separate IP ranges with semicolons (;), such as 1.1.1.0/24;2.2.2.2, some IP exceptions, no anti-leeching.
ignore-uri-slashString
Whether to remove / from $uri in anti-leech, the optional values are true or false, and the default is false, that is, it contains /. For example: http://www.test.com/1.flv, then $uri is /1.flv by default, if ignore-uri-slash is true, then $uri is 1.flv
ignore-key-and-time-positionString
Whether key and time are allowed to be interchanged, the optional values are true and false, true is allowed, false is not allowed. By default, the order of key parameters and time parameters must strictly follow the order required by the authentication mode, that is, the default key and time cannot be interchanged. If true is selected, the key and time positions can be interchanged and the authentication succeeds.
encrypt-methodString
Encryption Algorithm. Support value: md5sum
cipher-combinationString
The anti-leech chain generation method, the parameters involved in the MD5 calculation and the combination sequence only support the following parameters: $uri: A string between domain and question mark, special values are configured in the input parameter For example http://cdn.example.com/v0/test.dat?k=v, the URI is /v0/test.dat $ourkey: secret key, the actual secret key is configured in the input parameter $time: time string $spec_name: file name For example: http://cdn.example.com/v0/test.dat?k=v, the file name is test.dat $args: the value of a specific key in QUERY_STRING Example: $uri$ourkey$time$args{k} Notice: 1. K in $args{k} only allows A-Z uppercase and lowercase letters, numbers, underscores, and bars 2. Except for $args, other parameters are only allowed to appear once 3. Each parameter can be spliced according to any combination order
secret-keyString
The key of the anti-leech encryption string, only one key is allowed to be passed in Example: abcdef Notice: 1. For the secret key agreed with the customer, a value in can be equal to the corresponding value of 2. The value of $ourkey mainly comes from the configuration of a) If is not a value in multiple-secret-keys>, the value of $ourkey is b) is a value in multiple-secret-keys>, then the value of $ourkey is c) If is not passed or is empty, then the value of $ourkey is
cipher-paramString
Parameter name of the anti-leech string Example: keyname Notice: 1. If the anti-leech encryption string is in the parameter after the question mark in the url, the parameter name of the anti-leech encryption string is determined by the configuration of ; 2. If is empty, the key is used as the parameter name in the URL of the default request
time-paramString
Parameter name for time string Example: tname Notice: 1. If the anti-leech time string is placed in the parameter after the url question mark, the parameter name of the anti-leech time string is determined by the configuration of ; 2. If is empty, time is used as the parameter name in the URL of the default request
lower-limit-expiry-timeInteger
The lower limit of the expiration time of the anti-leech chain Example: 200 The configuration methods corresponding to various scenarios are as follows: Notice: 1. If the timestamp carried in the request URL is the generation time of the URL, the expiration time needs to be added with the effective duration, that is, and are configured as the effective duration . 2. If the timestamp carried in the URL is the expiration time, it can be set to zero.
upper-limit-expiry-timeInteger
The upper limit of the expiration time of the anti-leech chain Example: 5000 The configuration methods corresponding to various scenarios are as follows: Notice: 1. If the timestamp carried in the request URL is the generation time of the URL, the expiration time needs to be added with the effective duration, that is, and are configured as the effective duration . 2. If the timestamp carried in the URL is the expiration time, it can be set to zero.
multiple-secret-keysString
Anti-leech encrypted string, multiple encrypted strings are supported, and multiple encrypted strings are separated by semicolons (;) Example: abcdef;uvwxyz Notice: 1. Support setting multiple keys for url anti-leech. Support customers to modify the key at will, and achieve seamless switching. The anti-theft chain level is higher. 2. As long as the key of the requested url is consistent with the key calculated from any of the encrypted strings, the verification will pass
time-formatString
The time format of the anti-leech encryption string, Year|Month|Day|Hour|Minute|Second:1Y;2m;3d;4H;5M;6S UNIX timestamp:7s Millisecond-level UNIX timestamp:7s;9ms Hexadecimal timestamp:8x Notice: The format is fixed; numbers and letters must not be changed, and each value can only appear once.
request-url-styleString
The anti-leech request url format supports two anti-leech methods, that is, the encrypted string and timestamp are placed after "?" or the encrypted string and timestamp are placed after "host". The parameters supported by the url format are as follows: $domain: domain name $uri: the url part that does not contain the domain name $key: MD5 value of anti-leech encrypted string $time: Anti-leech time string $args: the QUERY_STRING parameter after the question mark Example: The following request url format is supported, which can be replaced with https://. The url request protocol is based on actual use. If you don't know how to configure it correctly, please ask customer technical support for assistance; the parameter name carrying two values of encrypted string and time string" keyname" and "tname", which can be replaced by the actual parameter names used http://$domain/$key/$time/$uri?$args http://$domain/$time/$key/$uri?$args http://$domain/$uri?auth_key=$key http://$domain/$uri?keyname=$key&tname=$time http://$domain/$uri?$args&keyname=$key&tname=$time http://$domain/$uri?keyname=$key&tname=$time&$args http://$domain/$uri?$args&keyname=$key&tname=$time&$args http://$domain/$uri?tname=$time&keyname=$key http://$domain/$uri?$args&tname=$time&keyname=$key http://$domain/$uri?tname=$time&keyname=$key&$args http://$domain/$uri?$args&tname=$time&keyname=$key&$args Notice: 1. The input url must start with "http/https" 2. If the encrypted string and timestamp are placed after "?", the keyname and tname must be consistent with the configured values of and 3. If there is no configuration value for and , the parameter name corresponding to $key defaults to key, and the parameter name corresponding to $time defaults to time 4. If the anti-leech encryption string and time string are in the parameters behind the question mark in the url, the "keyname" and "tname" in the url correspond to the anti-leech string and time string parameter names configured in cipher-param and time-param.
dst-styleInteger
Anti-leech back-to-source method, optional values: 1 (use unencrypted url to go back to the source), 2 (use the customer request to return to the source with encrypted string url) Example: 1 Notice: 1. If the URL format is: http://www.xxx.com/md5/time/uri? parameter, please contact your technical support.
log-formatString
Logging original url, optional values: true (logging original url), false (do not enable logging original url)
url-keyString
Used to configure the name of the key in the url Example: auth_key
special-encryptionString
Special encryption, values: 1 to enable, or leave blank
effective-timeString
Effective time, unit:s
except-file-typeString
Exceptional file type, multiple values separated by English semicolons (;), optional values: f4m ico m3u8 wmv jpeg shtml wma ts png zip bmp css html txt gif swf js bootstarp rar xml flv exe jpg htm mp4 mp3 Example: gif;png
except-custom-file-typeString
Exceptional custom file type, multiple values separated by English semicolons (;) Example: wml;apk

Response parameter(s)

Response Header

NameDescription
x-cnc-request-idString
Uniquely identified id for querying tasks per request (for all API)

Body Params

NameDescription
codeString
Error code. It pops up when the HTTPStatus is not 202, and shows the revoking error type of the current request.
messageString
Response message, and shows as success when it succeeds.

Error code

Error code(code)Description(message)HTTP statusSemantic
InternalErrorWe encountered an internal error. Please try again.500We encountered an internal error. Please try again.
InvalidParameterNo domain was specified.400No domain was specified.
NoSuchDomainThe specified domain does not exist.404The specified domain does not exist.
ConfigErrorThe config {} does not access.400The config {} does not access.
DomainNotRestoredThe domain you are trying to cancel has not been restored.409The domain you are trying to cancel has not been restored.
ForbiddenThe domain is being deleted403The domain is being deleted
WrongDataIdWrong data-d.400Wrong data-d.
InternalErrorWe encountered an internal error. Please try again.500We encountered an internal error. Please try again.
NoSuchDomainThe specified domain does not exist.404The specified domain does not exist.
CustomerNoOwnDomaincustomer not own domain name[*]400customer not own domain name[*]
InvalidParameterNo domain was specified.400No domain was specified.
InvalidParameterThe specified allowed-ips was invalid.400The specified allowed-ips was invalid.
InvalidParameterThe specified cipher-combination was invalid.400The specified cipher-combination was invalid.
InvalidParameterThe specified lower-limit-expiry-time must be digits.400The specified lower-limit-expiry-time must be digits.
InvalidParameterThe specified upper-limit-expiry-time must be digits.400The specified upper-limit-expiry-time must be digits.
InvalidParameterThe specified time-format was invalid.400The specified time-format was invalid.
InvalidParameterThe time-format's value separated by semicolon can appear only once.400The time-format's value separated by semicolon can appear only once.
InvalidParameterThe specified request-url-style was invalid.400The specified request-url-style was invalid.
InvalidParameterThe specified dst-style is either 1 or 2.400The specified dst-style is either 1 or 2.
InvalidParameterThe specified encrypt-method was invalid.400The specified encrypt-method was invalid.
InvalidParameterThe specified log-format was invalid.400The specified log-format was invalid.
InvalidParameterThe specified m3u8 was invalid.400The specified m3u8 was invalid.
InvalidParameterThe path-pattern is required when path-pattern-protocol has value.400The path-pattern is required when path-pattern-protocol has value.
InvalidParameterThe specified (timestamp-control-rule/path-pattern-protocol) was invalid.400The specified (timestamp-control-rule/path-pattern-protocol) was invalid.
InvalidParameterThe except-path-pattern is required when except-path-pattern-protocol has value.400The except-path-pattern is required when except-path-pattern-protocol has value.
InvalidParameterThe specified (timestamp-control-rule/except-path-pattern-protocol) was invalid.400The specified (timestamp-control-rule/except-path-pattern-protocol) was invalid.
InvalidParameterThe specified (timestamp-control-rule/cipher-combination) was invalid.400The specified (timestamp-control-rule/cipher-combination) was invalid.
InvalidParameterThe specified (timestamp-control-rule/lower-limit-expiry-time) must be digits.400The specified (timestamp-control-rule/lower-limit-expiry-time) must be digits.
InvalidParameterThe specified (timestamp-control-rule/upper-limit-expiry-time) must be digits.400The specified (timestamp-control-rule/upper-limit-expiry-time) must be digits.
InvalidParameterThe specified (timestamp-control-rule/request-url-style) was invalid.400The specified (timestamp-control-rule/request-url-style) was invalid.
InvalidParameterThe (timestamp-control-rule/uri-select) was invalid.400The (timestamp-control-rule/uri-select) was invalid.
InvalidParameterConflicting request parameters,The  parameters "cipher-combination|secret-key|cipher-param|time-param|lower-limit-expiry-time|upper-limit-expiry-time" must only exist in "timestamp-visit-control-rule" or "timestamp-control-rules".400Conflicting request parameters,The  parameters "cipher-combination|secret-key|cipher-param|time-param|lower-limit-expiry-time|upper-limit-expiry-time" must only exist in "timestamp-visit-control-rule" or "timestamp-control-rules".
InvalidParameterConflicting request parameters, The  parameters "request-url-style" must only exist in "timestamp-visit-control-rule" or "timestamp-control-rules".400Conflicting request parameters, The  parameters "request-url-style" must only exist in "timestamp-visit-control-rule" or "timestamp-control-rules".
MalformedXML400<![CDATA[cvc-pattern-valid: element request-url-style is invalid. the $key's parameter key is inconsistent with the value of element cipher-param.]]>
ConfigError[The format of request URL] just one value can be configured.400[The format of request URL] just one value can be configured.
ConfigError[Access Control generation method] just one value can be configured.400[Access Control generation method] just one value can be configured.
InvalidParameterThe path-pattern and directory cannot have values at the same time.400The path-pattern and directory cannot have values at the same time.

Example

JSON
XML
JSON
Request example
Copy Copy success
#!/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/timecontrol/www.aaa.com" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
    "timestamp-visit-control-rule":{
        "path-pattern":"/*",
        "except-path-pattern":"/*",
        "allowed-ips":"1.1.1.1",
        "cipher-combination":"$uri$ourkey$time$args{param1}",
        "secret-key":"ad",
        "cipher-param":"keyname",
        "time-param":"tname",
        "lower-limit-expiry-time":"60",
        "upper-limit-expiry-time":"60",
        "multiple-secret-keys":"60",
        "time-format":"1Y;2m;3d;4H;5M;6S",
        "request-url-style":"http://$domain/$uri?$args&keyname=$key&tname=$time",
        "dst-style":"1",
        "encrypt-method":"md5sum",
		"special-encryption": "1",
		"effective-time": "10"
    }
}'
Response example
Copy Copy success
HTTP/1.1 202 Accepted
Server: openresty/1.11.2.2
Date: Wed, 15 May 2019 07:31:43 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 60
Connection: keep-alive
App-Name: service_confApi
x-cnc-request-id: 5c429816-5fda-4d6d
{
    "message":"success",
    "code":""
}