HeadSpin Documentation
Documentation

API for Automation Configuration

The HeadSpin Automation Configuration API provides you with the optimal minimum Desired Capabilities to use for a given device and the WebDriver URL. To recap, Desired Capabilities tell Appium or Selenium how you want your test to work. They are represented as keys and associated values encoded in a JSON object and sent by the Appium or Selenium client to the Appium or Selenium server.


curl https://<your_api_token>@api-dev.headspin.io/v0/devices/automation-config

This is an example response:


...
    "ce0917194392a140017e@proxy-us-nyc-4.headspin.io": {
        "device_location": {
            "city": "nyc",
            "carrier": "AT&T",
            "country_readable": "US",
            "city_readable": "New York",
            "lat": 40.7127837,
            "country": "us",
            "lon": -74.0059413
        },
        "lock_url": "https://us-nyc.headspin.io:7016/v0//lock",
        "working_dir": "/home/pbox/appium_tests/ce0917194392a140017e",
        "capabilities": {
            "deviceName": "ce0917194392a140017e",
            "autoAcceptAlerts": "true",
            "udid": "ce0917194392a140017e",
            "automationName": "UiAutomator2",
            "platformName": "Android",
        },
        "host": "proxy-us-nyc-4.headspin.io",
        "unlock_url": "https://us-nyc.headspin.io:7016/v0//unlock",
        "driver_url": "https://us-nyc.headspin.io:7016/v0//wd/hub",
        "device_carrier": {
            "network_subtype": "LTE",
            "network_connected": true,
            "network_type": "MOBILE",
            "phone_network": "LTE",
            "carrier": "AT&T"
        },
        "os": "android",
        "control_url": "https://us-nyc.headspin.io:10100"
...

The <code class="dcode">capabilities</code> object will have the values for your Desired Capabilities. The <code class="dcode">driver_url</code> will be the remote WebDriver you will use in your test.

Each key is a device address (e.g. <code class="dcode">ce0917194392a140017e@proxy-us-nyc-4.headspin.io</code>). The value is a JSON object that includes information such as <code class="dcode">capabilities</code> associated with the device address or <code class="dcode">null</code> if the device was not available.

Automation configurations can be filtered using Device Selectors.


curl -X GET https://<your_api_token>@api-dev.headspin.io/v0/devices/device_type:ios+os_version:>=12*+hostname:{hostname}/automation-config

This is an example response.


...
{
    "5eb0daf430faf52a14dad6ad22e6fd9314eb8fe3@proxy-us-nyc-4.headspin.io":
        {
            "device_location":
                {
                    "city": "nyc",
                    "carrier": "AT&T",
                    "country_readable": "US",
                    "city_readable": "New York",
                    "lat": 40.7127837,
                    "country": "us",
                    "lon": -74.0059413
                },
            "lock_url": "https://us-nyc.headspin.io:7016/v0/{api_token}/lock",
            "capabilities":
                {
                    "deviceName": "iPhone X",
                    "udid": "5eb0daf430faf52a14dad6ad22e6fd9314eb8fe3",
                    "automationName": "xcuitest",
                    "platformVersion": "12.0",
                    "platformName": "ios",
                    "bundleId": "com.apple.Preferences"
                },
            "driver_lb_url": "https://us-nyc.headspin.io:7016/{api_token}/wd/hub",
            "host": "proxy-us-nyc-4.headspin.io",
            "unlock_url": "https://us-nyc.headspin.io:7016/v0/<your_api_token>/unlock",
            "driver_url": "https://us-nyc.headspin.io:7016/v0/<your_api_token>/wd/hub",
            "device_carrier":
                {
                    "network_subtype": null,
                    "network_connected": false,
                    "network_type": "MOBILE",
                    "phone_network": null,
                    "carrier": null
                },
            "os": "ios",
            "control_url": "https://us-nyc.headspin.io:10100"
        }
}
...

Check available Appium versions

The HeadSpin host provides the list of available Appium versions as API. It helps to confirm which Appium versions can run on the host machine. Please contact us if you want to use a particular Appium version which is not available on the host machine.

The minimum supported version is <code class="dcode">1.11.0</code>.

Route Method
https://{<hosting company>-host}:{<hosting company>-port}/v0/{your-api-token}/wd/hub/versions GET

Example


curl -X GET https://proxy-jp-tyo-1.headspin.io:7001/v0/{your-api-token}/wd/hub/versions

Response


{
    "status": 0,
    "session_id": null,
    "value": {
        "available": ["1.20.2", "1017.0", "1.14.0"],
        "default": "1.20.2"
    }
}

The <code class="dcode">available</code> is available Appium versions. You can specify them as <code class="dcode">headspin:appiumVersion</code>. The <code class="dcode">default</code> is chosen if a create session capability does not contain <code class="dcode">headspin:appiumVersion</code>.

Check available Browser versions for Selenium

HeadSpin host provides the list of available browser versions as API. It helps to confirm which browser versions can run on the host machine.

Route Method
https://{<company name>-host}:{<company name>-port}/v0/{your-api-token}/versions GET

Example


curl -X GET https://proxy-jp-tyo-1.headspin.io:7001/v0/{your-api-token}/versions

Response


{
    "value": {
        "default": {
            "chrome": "78.0.3904.108", "firefox": "70.0.1", "safari": "12", "microsoftedge": "78.0.250.1"},
            "available": {
                "chrome": {"76.0.3809.126": "76.0.3809.126", "77.0.3865.10": "77.0.0.0"},
                "firefox": {"70.0.1": "0.26.0"},
                "microsoftedge": {"78.0.250.1": "78.0.250.1", "77.0.237.0": "77.0.237.0"},
                "safari": {"12": "12"}
            }
    }
}

The <code class="dcode">available</code> is available browser versions. You can specify them with browserName and <code class="dcode">browserVersion</code>. The <code class="dcode">default</code> is chosen if a create session capabilities has no <code class="dcode">browserVersion</code>.

Please contact us if you would like to use a version which is not in the list.

Chrome DevTools - Waiting for session to be ready

You can use this request to detect when the browser is ready for DevTools clients like Puppeteer to run their scenario. When DevTools protocol is available via <code class="dcode">hs connect browser</code> command, <code class="dcode">curl -X GET http://localhost:9222/json</code> will return a JSON response with 200 HTTP status code like so:


[ {
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/6C6F9E6251B4FC3843BA67AD82751EBB",
   "id": "6C6F9E6251B4FC3843BA67AD82751EBB",
   "title": "data:,",
   "type": "page",
   "url": "data:,",
   "webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/6C6F9E6251B4FC3843BA67AD82751EBB"
} ]

<code class="dcode">webSocketDebuggerUrl</code> is <code class="dcode">wsEndpoint</code> in Puppeteer or Playwright libraries.

For more information regarding scenarios in which to use this API, please see our DevTools documentation here.