Prefetch documents - POST /api/prefetch

Parent Previous Next

POST /api/prefetch                            

Prefetch content to QUANTIL servers before users have requested them.  This improves responsiveness for the initial visitor.  You can prefetch up to 5000 URLs per day.


Request Syntax


Request Headers


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

Request Body Elements


Element

Description

prefetch-urls

Container object which describe the urls to be prefetched. It should include a <version> child element and one or more <prefetch-url> child elements.

version

a version string, i.e., 1.0.0

prefetch-url

Url of a file to prefetch.  The url must include the domain. Example: http://quantil.com/test/a.htm




Request Syntax:


POST /api/prefetch HTTP/1.1

Authorization: <authorization string>

Host: api.quantil.com

Date: <date>

Accept: application/xml


Here is the structure of a request using the curl utility.


curl -i -url https://api.quantil.com/api/prefetch

-X POST

-u {user}: {password}

-H 'Date: Thu, 17 May 2012 19:37:58 GMT'

-H 'Accept: application / xml'

-D '<? Xml version = "1.0" encoding = "UTF-8"?>

<prefetch-urls>

<version> 1.0.0 </ version>

<prefetch-url> {your file url including the domain name you want to fetch} </ prefetch-url>

<prefetch-url> {your file url including the domain name you want to fetch} </ prefetch-url>

</ Prefetch-urls> '


Sample Request:


curl -i --url 'https://api.quantil.com/api/prefetch' -X POST -u apiuser:3dbkz+o6FtIa39IBHxzzsli/egU= -H 'Date: Thu, 24 Sep 2015 14:01:44 PDT' -H 'Accept: application/xml' -d '<?xml version="1.0" encoding="UTF-8"?> <prefetch-urls> <version>1.0.0</version> <prefetch-url>http://mynewtestdomain1.com/1.txt</prefetch-url> <prefetch-url>http://mynewtestdomain1.com/mydir</prefetch-url> </prefetch-urls>'


Response Details:


Response Headers:

HTTP / 1.1 202 Accepted

Date: <date>

Content-Type: application / xml; charset = utf-8

x-cnc-request-id: {id string auto generated by the QUANTIL server}


Response Body Elements

Element

Description

response

container for additional information from the QUANTIL server.

message

a message returned by the QUANTIL server.  



Sample Response:

HTTP/1.1 202 Accepted

Date: Thu, 24 Sep 2015 21:01:46 GMT

Accept-Ranges: bytes

Server: WS-web-server

x-cnc-request-id: 14266125

ContentType: application/xml;charset=UTF-8

Location: /api/prefetch/217eb230-b358-462c-b248-38aaa65ae5b3

Content-Type: application/xml;charset=UTF-8

Content-Length: 86


<?xml version="1.0" encoding="UTF-8"?>

<response><message>success</message></response>

Error List


Error

Description

HTTP status code

PrefetchUrlError

The urls cannot be prefetched.

404