HTTP EndpointAPI Client Library Documentation
This documentation is for the HTTP Endpoint. For
For API Libraries and Examples in these or other languages, refer to the Docs Index Page
We have introduced a new rendering engine based on Chrome. It offers a superior experience to Webkit, the old rendering system. If you want to use the old webkit rendering, include
backend:"webkit" in your request.
These examples use
GET requests because they are the simplest way of showing examples and getting started, but it is strongly suggested you use the
POST endpoint for "real" usage.
pngif you need transparency (if the backgrounds are weirdly black)
@media:printdirectives if you set IRenderSettings.emulateMedia, but we default to @media:screen for improved compatibility *
pageResponse.pageRequestfor the default values to other parameters.
imgtag. For more info on using selectors, see IRenderSettings.selector(https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)
viewportto 640px width, zooms out, and sets a 640x500
clipRectangleto generate a thumbnail image of the CNN.com website.
www.highcharts.comhas been replaced with
wikipedia.orgbut the path is preserved. read the text of the output error message to see this.
clearCache:trueparameter. This is required so that .css resources are re-requested and blocked.
clearCache:trueparameter. This is required so that all resources are re-requested so headers are populated.
Accept-encoding:tacosvalues in the resulting HTML. Uses our example show request details page
tv2.dksite lazy loads images only when it's shown in the browser, so if you take a screenshot without the provided script, the bottom part will be missing images. Important: This page takes aprox 25 seconds to load, and weighs aprox 2mb in size. (Costs about 0.0047 credits)
outputAsJson:trueor you will not get usable results
application/jsoncontent-type and submit POST data. Check the
payloadsection of the output results.
resourceTimeoutparameter like this example does. We will be developing our own proxy service in the coming months.
Other Examples: See the Docs Index Page Usage FAQ for other examples (such as Page Automation / Button Clicking)
Test Pages: These pages are used in some of the above examples, and might be useful to you when evaluating this service:
To use this API, you need to submit a
POST request to the API endpoint:
GET requests are the simplest way of showing examples and getting started, but it is strongly suggested you use the
POST endpoint for "real" usage.
[REQUEST-JSON]should be encoded via
encodeURIComponent(), do not encode the parts individually.
Your key used for creditBalance/billing. You can obtain this by signing up, or use the special key
a-demo-key-with-low-quota-per-ip-address for testing.
The details of your request as a JSON object. This JSON can take one of the following three forms, each of which are described here:
url is required, everything else is optional. Click here to view the default values if you leave the various parameters blank
You can use
CORS (preferred) or
JSONP to integrate api calls from PhantomJs Cloud directly into your webpage.
CORSenabled by default.
JSONPformat, add the
?callback=CALLBACK_FUNCTION_NAMEquerystring to your request (for either
POSTrequests). You MUST set
outputAsJson:truefor JSONP to work. Here is an example JSONP simple request.
Please refer to the main Docs Index Page for Basic Troubleshooting, Testing and Performance Optimization, Usage FAQ, and language-specific samples.
select the browser engine you will use
you may choose from the following shortcuts: "
webkit pjs2.1.1, will change to
chrome. may change at any time as this is for testing new backends or feature enhancements.
webkit: the latest stabke version of the default PhantomJs rendering engine:
chrome: the latest stable version of chrome
or choose a specific backend:
the different event phases that a page goes through
new for Chrome backend. summary of all resources requested during the page execution, and their current status upon page completion.
aborted because the resource exceeded IRequestSettings.resourceTimeout
requests that were still active (but healthy) upon page completion
successfully completed resource loads
failed due to normal browser workflows
requests that were still active (but took longer than IRequestSettings.resourceWait) upon page completion
if the browser looses track of resource request/response pairs, it will be put here (should never happen)