Options
All
  • Public
  • Public/Protected
  • All
Menu

PhantomJsCloud.com HTTP Endpoint API Client Library Documentation

This documentation is for the HTTP Endpoint. For GET and POST requests.

Using Curl, C#, PHP, Python, or Node.js?

For API Libraries and Examples in these or other languages, refer to the Docs Index Page

Important Notice: Chrome upgrade

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.

Examples! (Quick Start)

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.

Basic Examples:

Advanced Examples:

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:

Usage

To use this API, you need to submit a GET or POST request to the API endpoint:

GET:

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.

  • Url (uriComponent encoded requests)
    • http(s)://PhantomJsCloud.com/api/browser/v2/[YOUR-KEY]/?request=[REQUEST-JSON]
    • The entirety of your [REQUEST-JSON] should be encoded via encodeURIComponent(), do not encode the parts individually.
  • Url (base64 encoded requests)
    • http(s)://PhantomJsCloud.com/api/browser/v2/[YOUR-KEY]/?requestBase64=[REQUEST-JSON] \t- The entirety of your [REQUEST-JSON] should be Base64 Encoded, do not encode the parts individually, and do not urlEncode before you Base64 Encode.

POST:

  • Url
    • http(s)://PhantomJsCloud.com/api/browser/v2/[YOUR-KEY]/
  • Post Body
    • [REQUEST-JSON]
    • You should not Base64 Encode, nor UrlEncode your Post Body, or any of it's parts.
  • Content Type
    • application/json

Input Parameters

[YOUR-KEY]

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.

[REQUEST-JSON]

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:

  • A single IPageRequest object (the simplest approach)
    • Example: {url:"http://www.example.com",renderType:"jpg",outputAsJson:true}
  • Array of IPageRequest objects. This will cause each page to be visited in order, with the last IPageRequest being rendered.
    • Example: [{url:"http://www.google.com"},{url:"https://www.google.com/doodles/",renderType:"jpg",outputAsJson:true}]
  • A IUserRequest object (Most complex: required if you want to use Proxy Servers).
    • Example: {proxy:false,pages:[{url:"http://www.google.com"},{url:"https://www.google.com/doodles/",renderType:"jpg",outputAsJson:true}]}

IPageRequest Default Values

While the url is required, everything else is optional. Click here to view the default values if you leave the various parameters blank

CORS/JSONP (Browser API Support)

You can use CORS (preferred) or JSONP to integrate api calls from PhantomJs Cloud directly into your webpage.

  • CORS: All endpoint are CORS enabled by default.
  • JSONP: To obtain results in JSONP format, add the ?callback=CALLBACK_FUNCTION_NAMEquerystring to your request (for either GET or POST requests). You MUST set outputAsJson:true for JSONP to work. Here is an example JSONP simple request.

Additional Documentation

Please refer to the main Docs Index Page for Basic Troubleshooting, Testing and Performance Optimization, Usage FAQ, and language-specific samples.

Index

Type aliases

IBackendType

IBackendType: "default" | "chrome" | "webkit" | "preview" | "webkit pjs2.1.1" | "webkit pjs2.5beta"

select the browser engine you will use

you may choose from the following shortcuts: "default", "preview", "webkit", "chrome"

default: currently webkit pjs2.1.1, will change to chrome soon

preview: currently 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: webkit pjs2.1.1

chrome: the latest stable version of chrome

or choose a specific backend: chrome v68, webkit pjs2.1.1, webkit pjs2.5beta