API Overview
The CrossBrowserTesting.com API allows you to implement our browser testing services within your own web and desktop applications via HTTP and XML (or JSON), enabling you to customize your website-testing process and workflow.
API Versions
The current API is version 2.0. The original version is now known as version 1.0 but was not documented as such prior to releasing version 2.0. There are some significant changes and added functionality in the new version, but version 1.0 is still supported. Older API calls will not be affected such that users will not have to rewrite their scripts unless they require functionality found only in the newer version.
Documentation
What can be done with API?
- Run Automated Screenshot Tests
- Retrieve Screenshot Test results
- Build links to automatically launch Live Tests
Downloads
API Basics
Request FormatsIn general, requests are defined by the following URL structure.
http://crossbrowsertesting.com/api/[api version]/[api service]/[api command]?[paramater]=[value]
- Parameters can be provided via GET or POST methods.
- If using GET method, parameter values should url-encoded.
- API version is has the syntax of v1 or v2.
- If no api version is specified, the version defaults to "v1" for compatibility with the original version.
- API services are either "screenshots or "livetests".
- API commands are detailed in the documentation.
After making a request, a response is returned according the the specified format (XML or JSON). Every response includes an error field and message field. If there is an error in the request, the error field is set to 1, and the reason is detailed in the message field.
XML
<?xml version="1.0" encoding="utf-8" ?>
<response>
<error>0</error>
<message></message>
...
</response>
JSON
{"response":{ error: 0, message: "", ... }}
Authenticating
Users must authenticate via Basic Authentication for each and every API request using the same login credentials as for their account. The only exceptions are API calls to list available browsers.
Authentication can be achieved by passing the credentials in the URL, like:
http://username:password@crossbrowsertesting.com/api/v2/screenshots/browsers
Or, using a language implementation, like Linux "curl":
curl --user username:password http://crossbrowsertesting.com/v2/api/screenshots/show
Booleans
Boolean values for both requests and responses are represented as integers: 0 for false, and 1 for true.
