Skip to main content

Sauce Connect API Methods

Use the Sauce Connect API methods to monitor and clean up your active proxy tunnels.

To download Sauce Connect, see Sauce Connect Installation.

Refer to Getting Started for Authentication and Server information.

What You'll Need#

Get Tunnels for a User#

GET /rest/v1/{username}/tunnels

Returns a list of IDs for any currently running tunnels launched by the specified user.

Parameters#

username

| PATH | OPTIONAL | STRING |

The authentication username of the user whose tunnels you are requesting.

Sample Request
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \--request GET 'https://api.us-west-1.saucelabs.com/rest/v1/jim.smith/tunnels' \--header 'Content-Type: application/json' | json_pp

Responses#

200Success.
404Not found.
Sample Response
[    "28e7c8133ede4588a891666dd35af1f8"]

Get Tunnel Information#

GET /rest/v1/{username}/tunnels/{tunnel_id}

Returns information about the specified tunnel.

Parameters#

username

| PATH | OPTIONAL | STRING |

The authentication username of the owner of the requested tunnel.

tunnel_id

| PATH | OPTIONAL | STRING |

The unique identifier of the requested tunnel.

Sample Request
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \--request GET 'https://api.us-west-1.saucelabs.com/rest/v1/jim.smith/tunnels/28e7c8133ede4588a891666dd35af1f8' \--header 'Content-Type: application/json' | json_pp

Responses#

200Success.
404Not found.
Sample Response
{    "team_ids": [...],    "ssh_port": 443,    "creation_time": 1618345938,    "domain_names": null,    "owner": "jim.smith",    "use_kgp": true,    "id": "28e7c8133ede4588a891666dd35af1f8",    "extra_info": "{\"metrics_host\": \"localhost\", \"metrics_port\": 8888, \"tunnel_cert\": \"public\", \"inject_job_id\": true, \"backend\": \"kgp\"}",    "direct_domains": null,    "vm_version": "",    "no_ssl_bump_domains": null,    "shared_tunnel": false,    "metadata": {...},    "status": "running",    "shutdown_time": null,    "host": "maki3429.miso.saucelabs.com",    "ip_address": null,    "last_connected": 1618346660,    "user_shutdown": null,    "use_caching_proxy": null,    "launch_time": 1618345940,    "no_proxy_caching": false,    "tunnel_identifier": "jim.smith_tunnel_id"}

Get Current Jobs for a Tunnel#

GET /rest/v1/{username}/tunnels/{tunnel_id}/num_jobs

Returns the number of currently running jobs for the specified tunnel.

Parameters#

username

| PATH | OPTIONAL | STRING |

The authentication username of the user whose tunnels you are requesting.

tunnel_id

| PATH | OPTIONAL | STRING |

The unique identifier of the requested tunnel.

Sample Request
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \--request GET 'https://apip.us-west-1.saucelabs.com/rest/v1/jim.smith/tunnels/28e7c8133ede4588a891666dd35af1f8/num_jobs' \--header 'Content-Type: application/json' | json_pp

Responses#

200Success.
404Not found.
Sample Response
{    "id": "28e7c8133ede4588a891666dd35af1f8",    "jobs_running": 1}

Stop a Tunnel#

DELETE /rest/v1/{username}/tunnels/{tunnel_id}

Shuts down the specified tunnel.

Parameters#

username

| PATH | OPTIONAL | STRING |

The authentication username of the user whose tunnels you are requesting.

tunnel_id

| PATH | OPTIONAL | STRING |

The unique identifier of the tunnel to stop.

Sample Request
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \--request DELETE 'https://api.us-west-1.saucelabs.com/rest/v1/jim.smith/tunnels/28e7c8133ede4588a891666dd35af1f8' \--header 'Content-Type: application/json' | json_pp

Responses#

200Success.
404Not found.
Sample Response
{    "result": true,    "id": "28e7c8133ede4588a891666dd35af1f8",    "jobs_running": 0}