Obtain QUANTIL's Download Acceleration service for a new domain.
Note: The syntax is the same as for Create Website Acceleration - Static only domain, but the value of <service-type> is "download", and there is optional support for client speed control described below.
Header |
Description |
Required |
Authorization |
Authorization string for the request |
Yes |
Host |
URI for the QUANTIL SDK (i.e., api.quantil.com) |
Yes |
Date |
The date and time of the request. |
Yes |
Accept |
Indicates the accepted format (i.e., application/xml) |
Yes |
QUANTIL supports many options allowing you to configure how your domain caching works and to override the default cache rules. Please refer to the list of standard elements.
In addition, our Download Acceleration service allows you to restrict users' download speed. The following additional elements are available and can be added to the <domain> container element:
Element |
Description |
client-control-rule |
This is an optional container object which can be added to the <domain> element to limit the speed of user downloads. It can contain one <access-speed-rules> element which contains one or more rules each defined in an <access-speed-rule> element. |
access-speed-rules |
This container object appears within a <client-control-rule> element and contains one or more rules each defined in an <access-speed-rule> element. If multiple rules are specified, the first applicable one will be used, and the rest will be ignored. |
access-speed-rule |
This element represents an individual rule to limit download speed. It should contain one <path-pattern> element and one <speed> element. |
path-pattern |
Enter a pattern in the URL Pattern field to specify the content affected by the caching rule. The URL pattern should begin with "/". Fuzzy string matching is supported. Use '*' as the wild card character which matches any character. The "|" character represents "or". For example, "/*.(jpg|png)" matches all jpg and png files under the root url. |
speed |
This element should be a value indicating the number of KiloBytes per second (kB/s) to restrict downloads to. |
Here is the structure of a request using the curl utility. Since most of the XML elements are optional, your request to create a domain can be much simpler. The minimum required elements are:
A brief summary of elements is listed in the sample below. Please refer to the Request Body Elements section for more information about each element.
curl -i --url https://api.quantil.com/api/domain
-X POST
-u {user}: {password}
-H 'Date: Thu, 17 May 2012 19:37:58 GMT'
-H 'Accept: application/xml'
-H 'Content-Type: application/xml'
-d '<?xml version = "1.0" encoding = "UTF-8"?>
<domain>
<version> 1.0.0 </version>
<domain-name> {domain-name} </domain-name>
<service-type> download </service-type>
<service-areas> {cn; euna; apac; nc; all} </service-areas>
<ssl>
<use-ssl> {true or false} </use-ssl>
<use-for-sni> {true or false} </use-for-sni>
<ssl-certificate-id> {the id of the certificate you provided before} </ssl-certificate-id>
<ssl-cipher-suite> {semicolon separated list of cipher suites} </ssl-cipher-suite>
</ssl>
<comment> {comment information} </comment>
<cname> { request a CNAME }</cname>
<non-acc-area-back2origin> {true or false} </non-acc-area-back2origin>
<origin-config>
<origin-ips> {multiple ip addresses split by semicolon OR one domain name} </origin-ips>
<!-- Complex policy settings for accessing the origin -->
<adv-origin-configs>
<detect-url> {the url to determine if the server is available} </detect-url>
<detect-period> {how often we check the status} </detect-period>
<adv-origin-config>
<master-ips> {master ip list, split by semicolon} </master-ips>
<backup-ips> {master ip list, split by semicolon} </backup-ips>
</adv-origin-config>
</adv-origin-configs>
<origin-protocol> {http or https} </origin-protocol>
<default-origin-port> {port number to use when connecting to origin} </default-origin-port>
<origin-rules>
<origin-rule>
<path> {a uri} </path>
<ignore-case> {true or false} </ignore-case>
<file-extensions> {file extensions to match} </file-extensions>
<origin-ips> {ips or a domain} </origin-ips>
<origin-port> {the port used to fetch content from origin server} </origin-port>
<origin-host-header> {the http header value which will be set to HOST header when fetching content from origin server} </origin-host-header>
<modified-option> {0, 1, or 2} </modified-option>
<modified-path> {the uri to update to} </modified-path>
<header-name> {HTTP header to match against} </header-name>
<header-value> {value of HTTP header to match against } </header-value>
</origin-rule>
<origin-rule>
...
</origin-rule>
</origin-rules>
</origin-config>
<!-- Caching rules -->
<cache-behaviors>
<cache-behavior>
<path-pattern> {path pattern} </path-pattern>
<ignore-cache-control> {true or false} </ignore-cache-control>
<cache-ttl> { number of seconds} </cache-ttl>
</cache-behavior>
</cache-behaviors>
<!-- Query string settings -->
<query-string-settings>
<query-string-setting>
<path-pattern> {path pattern} </path-pattern>
<ignore-query-string> {true or false} </ignore-query-string>
<source-with-query> {true or false} </source-with-query>
</query-string-setting>
</query-string-settings>
<!-- Access control for anti-hotlinking Settings -->
<visit-control-rules>
<visit-control-rule>
<path-pattern> {path pattern} </path-pattern>
<allownullreferer> {true or false} </allownullreferer>
<valid-referers>
<referer> {domain name for http referrer protection} </referer>
<referer> ... </referer>
</valid-referers>
<invalid-referers>
<referer> {domain name for http referrer protection} </referer>
<referer> ... </referer>
</invalid-referers>
<forbidden-ips> {forbidden ip section, address [/mask]} </forbidden-ips>
</visit-control-rule>
</visit-control-rules>
<log-option>
<log-storage-day> { number of days} </log-storage-day>
<timezone> {the time zone, from -12 to 12} </timezone>
</log-option>
<attack-detection-rule>
<path-pattern> {path pattern} </path-pattern>
<except-path-pattern> {exception path pattern} </except-path-pattern>
<ignore-case>{true or false}</ignore-case>
<single-ip-requests></single-ip-requests>
<single-ip-origin-requests></single-ip-origin-requests>
<statistics-period> {number of seconds} </statistics-period>
<allowed-ips></allowed-ips>
<action> {log or deny or disconnect} </action>
<limit-time> {number of minutes} </limit-time>
</attack-detection-rule>
<download-notify-rules>
<non-notify-status-code> {response codes that don't need notification} </non-notify-status-code>
<download-notify-rule>
<path-pattern> {path pattern} </path-pattern>
<except-path-pattern> { exception path pattern} </except-path-pattern>
<ignore-case> {true or false} </ignore-case>
<notify-http-method> {GET or POST} </notify-http-method>
<notify-url> {notify url} </notify-url>
<notify-param> <!-- [CDATA [key value pairs, looks like c = c & d = d]] --> </notify-param>
</download-notify-rule>
<download-notify-rule>
...
</download-notify-rule>
</download-notify-rules>
<http-header-rule>
<date-update> {true or false} </date-update>
</http-header-rule>
<!-- customization of the cache key used as index into QUANTIL's cache -->
<cache-host>{alternate host name to use in internal cache key} </cache-host>
<cache-key-rules>
<cache-key-rule>
<path-pattern></path-pattern>
<ignore-case> {true or false}</ignore-case>
<header-name> {HTTP header name whose value should be used} </header-name>
</cache-key-rule>
<cache-key-rule>
...
</cache-key-rule>
<authorize-request-to-origin-rules>
<authorize-request-to-origin-rule>
<path-pattern> {path pattern } </path-pattern>
<ignore-letter-case> {true or false} </ignore-letter-case>
</authorize-request-to-origin-rule>
<authorize-request-to-origin-rule>
...
</authorize-request-to-origin-rule>
</authorize-request-to-origin-rules>
<rewrite-rule-settings>
<rewrite-rule-setting>
<path-pattern> {path pattern} </path-pattern>
<rewrite-type> {protocol or url} </rewrite-type>
<before-value> </before-value>
<after-value> </after-value>
<ignore-query-string> {true or false} </ignore-query-string>
<rewrite-uas> {list of user agents }</rewrite-uas>
<rewrite-area> {list of country codes } </rewrite-area>
<rewrite-method> {HTTP status code} </rewrite-method>
</rewrite-rule-setting>
<rewrite-rule-setting>
...
</rewrite-rule-setting>
</rewrite-rule-settings>
<compression-settings>
<compression-enabled> {true or false} </compression-enabled>
<path-pattern> {path pattern} </path-pattern>
<ignore-case> {true or false} </ignore-case>
<file-types> {list of MIME file types} </file-types>
</compression-settings>
<back2origin-read-timeout> {number of seconds} </back2origin-read-timeout>
<back2origin-connect-timeout> {number of seconds} </back2origin-connect-timeout>
<!-- Client speed control -->
<client-control-rule>
<access-speed-rules>
<access-speed-rule>
<path-pattern> {path pattern} </path-pattern>
<speed> {speed limit} </speed>
</access-speed-rule>
</access-speed-rules>
</client-control-rule>
</domain>'
The following example using the curl command-line tool demonstrates the minimum XML needed to create a domain using QUANTIL's Download Acceleration product.
curl -i --url 'https://api.quantil.com/api/domain' -X POST -u testaccount:iJGeubaDaIJOEAEIVlLlFaiS62M= -H 'Date: Wed, 06 Aug 2014 10:03:49 PDT' -H 'Accept: application/xml' -d '<?xml version="1.0" encoding="UTF-8"?> <domain> <version>1.0.0</version> <service-type>download</service-type> <domain-name>mydownloaddomain.com</domain-name> <origin-config> <origin-ips>9.8.7.6</origin-ips> </origin-config> <service-areas>cn</service-areas> <log-option><log-storage-day>7</log-storage-day><timezone>7</timezone></log-option> </domain>'
HTTP/1.1 202 OK
Date: <date>
Content-Type: application/xml; charset = utf-8
x-cnc-request-id: {id string auto generated by the QUANTIL server}
Location: https://api.quantil.com/api/domain/ {domain-id}
cname: {cdn domain name, you need to cname your domain name to this name}
<?xml version = "1.0" encoding = "UTF-8"?>
<response>
<message> {the message returned by the cloud server} </message>
</response>
The Location header is a url allowing you to access the domain information. The domain-id is generated by the QUANTIL system and uniquely identifies the domain.
The cname header contains an automatically generated domain name. Important: You will need to modify your domain's DNS to refer to this value to get the benefit of QUANTIL's acceleration.
Element |
Description |
response |
container for additional information from the QUANTIL server. |
message |
a message returned by the QUANTIL server. If the domain was successfully created, the text will be 'success'. |
code |
This element appears if an error occurs. The body will be an error message such as "DomainAlreadyExists". Refer to the error list below. |
HTTP/1.1 202 Accepted
Date: Wed, 06 Aug 2014 17:03:51 GMT
Accept-Ranges: bytes
Location: https://api.quantil.com/api/domain/5445>
Server: WS-web-server
x-cnc-request-id: 1112457
ContentType: application/xml;charset=UTF-8
cname: kupxli6bqru7hi.wscloudcdn.com
Content-Type: application/xml;charset=UTF-8
Content-Length: 86
<?xml version="1.0" encoding="UTF-8"?>
<response><message>success</message></response>
Error |
Description |
HTTP status code |
DomainAlreadyExists |
The domain name you specified is already in our system. |
409 |
ICPNotFound |
We are unable to find the ICP number for the domain you specified. An ICP license is required for service in China. |
400 |
InvalidCNAME |
The CNAME must match an existing CNAME or be in the format 'Random.cdn20.com', 'Random.whecloud.com', 'DomainName.cdn20.com', or 'DomainName.whecloud.com'. Cdn20.com should be used if your domain has an ICP license for service in China while whecloud.com should be used if your domain does not have an ICP license. |
400 |
InvalidFields |
Incorrect values were used for a field. The response's message will provide more details about the specific problem |
400 |
InvalidOrigin |
The origin configuration is not valid |
400 |
MissingBody |
This operation requires a body. Ensure that the body is present and the Content-Type header is set. |
400 |
NoSuchCertificate |
The certificate id was not found. |
404 |
SSLCertNotSupportDomain |
The SSL certificate does not support the domain. The domain is not listed in the certificate's Common Name or Subject Alternative Name field. |
400 |