Querying a Cache Rule
Function
This API is used to query a cache rule.
URI
GET /v1.0/cdn/domains/{domain_id}/cache
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
domain_id |
Yes |
String |
Specifies the acceleration domain name ID. For details, see Querying Details About a Domain Name. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enterprise_project_id |
No |
String |
Enterprise project that the resource belongs to. This parameter is valid only when the enterprise project function is enabled. The value all indicates all projects. This parameter is mandatory when you use an IAM user to call this API. Obtain the enterprise project ID by calling the ListEnterpriseProject API of Enterprise Project Management Service (EPS). |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the user token. The token can be obtained by calling the IAM API used to obtain a user token. The value of **X-Subject-Token** in the response header is the user token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
cache_config |
CacheConfig object |
Specifies the cache configuration. |
Parameter |
Type |
Description |
---|---|---|
ignore_url_parameter |
Boolean |
Specifies whether to ignore URL parameters. |
follow_origin |
Boolean |
Specifies whether to enable origin cache control. |
compress |
CompressResponse object |
Specifies the gzip compression settings. |
rules |
Array of Rules objects |
Specifies the cache rules, which overwrite the previous rule configurations. Blank rules are reset to default rules. Array Length: 1 - 20 |
Parameter |
Type |
Description |
---|---|---|
compress_switch |
Integer |
Specifies whether gzip compression is enabled. Possible values: 0 (disabled) and 1 (enabled). |
compress_rules |
Array of CompressRules objects |
Specifies the gzip compression rule. |
Parameter |
Type |
Description |
---|---|---|
compress_type |
String |
Specifies the compression type. Currently, the value can only be set to gzip. |
compress_file_type |
String |
Specifies the file types supported by gzip compression. File types are separated by vertical bars (|), for example, .js|.html|.css|.xml. |
Parameter |
Type |
Description |
---|---|---|
rule_type |
Integer |
0: All types of files are matched. It is the default value. 1: Files are matched based on their suffixes. 2: Files are matched based on their directories. 3: Files are matched based on their full paths. |
content |
String |
Specifies the content that matches rule_type. If rule_type is set to 0, this parameter is empty. If rule_type is set to 1, the value of this parameter is a list of file name extensions. A file name extension starts with a period (.). File name extensions are separated by semicolons (;), for example, .jpg;.zip;.exe. If rule_type is set to 2, the value of this parameter is a list of directories. A directory starts with a slash (/). Directories are separated by semicolons (;), for example, /test/folder01;/test/folder02. If rule_type is set to 3, the value of this parameter is a full path. A full path starts with a slash (/). Wildcard characters (*) are supported. For example, /test/index.html and /test/*.jpg. |
ttl |
Integer |
Specifies the cache age. The maximum cache age is 365 days. |
ttl_type |
Integer |
Specifies the unit of the cache age. Possible values: 1 (second), 2 (minute), 3 (hour), and 4 (day). |
priority |
Integer |
Specifies the priority weight of this rule. The default value is 1. A larger value indicates a higher priority. The value ranges from 1 to 100. The weight values must be unique. |
Example Requests
GET https://cdn.myhuaweicloud.com/v1.0/cdn/domains/ff8080**********************d71/cache?enterprise_project_id=0
Example Responses
Status code: 200
OK
{ "cache_config" : { "rules" : [ { "rule_type" : 1, "content" : ".jpg;.png", "ttl" : 30, "ttl_type" : 3, "priority" : 1 }, { "rule_type" : 0, "content" : "", "ttl" : 600, "ttl_type" : 1, "priority" : 1 } ], "ignore_url_parameter" : false, "follow_origin" : false, "compress" : { "compress_switch" : 1, "compress_rules" : [ { "compress_type" : "gzip", "compress_file_type" : ".js|.html|.css|.xml|.json|.shtml|.htm" } ] } } }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot