The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Analytics

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

Choosing a REST API Endpoint

If you run Appium tests with your:

Sauce Labs CredentialsTest Object  Credentials

Please use the Unified Platform Storage REST API (app.saucelabs.com

To retrieve your Sauce Labs credentials:

Please use the Legacy Real Device Cloud REST API (app.testobject.com)

To retrieve your Test Object credentials:

Below are some examples of how to use the Sauce Labs REST API to upload your mobile application to Sauce Storage. Please select your Sauce Labs Testing Platform whether you're using Test Object (Legacy) or the Sauce Labs Unified Platform.

Unified Platform API

US Data Center

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://api.us-west-1.saucelabs.com/v1/rdc/apps/upload -H \
"Content-Type: application/octet-stream" --data-binary @your_app.apk

Useful Header Parameters

App-DisplayName

A custom display name for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://api.us-west-1.saucelabs.com/v1/rdc/apps/upload -H \
"Content-Type: application/octet-stream" -H \
"App-DisplayName: yourCustomDisplayName" --data-binary @your_app.apk


App-Identifer

A custom identifier for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://api.us-west-1.saucelabs.com/v1/rdc/apps/upload -H \
"Content-Type: application/octet-stream" -H \
"App-Identifier: identifier_for_your_app" --data-binary @your_app.apk

EU Data Center

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://api.eu-central-1.saucelabs.com/v1/rdc/apps/upload -H \
"Content-Type: application/octet-stream" --data-binary @your_app.apk

Useful Header Parameters

App-DisplayName

A custom display name for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://api.eu-central-1.saucelabs.com/v1/rdc/apps/upload -H \
"Content-Type: application/octet-stream" -H \
"App-DisplayName: yourCustomDisplayName" --data-binary @your_app.apk


App-Identifer

A custom identifier for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://api.eu-central-1.saucelabs.com/v1/rdc/apps/upload -H \
"Content-Type: application/octet-stream" -H \
"App-Identifier: identifier_for_your_app" --data-binary @your_app.apk



Legacy Real Device API

US Data Center

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://app.testobject.com:443/api/storage/upload -H \
"Content-Type: application/octet-stream" --data-binary @your_app.apk

Useful Header Parameters

App-DisplayName

A custom display name for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://app.testobject.com:443/api/storage/upload -H \
"Content-Type: application/octet-stream" -H \
"App-DisplayName: yourCustomDisplayName" --data-binary @your_app.apk


App-Identifer

A custom identifier for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://app.testobject.com:443/api/storage/upload -H \
"Content-Type: application/octet-stream" -H \
"App-Identifier: identifier_for_your_app" --data-binary @your_app.apk

EU Data Center

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://app.testobject.com:443/api/storage/upload -H \
"Content-Type: application/octet-stream" --data-binary @your_app.apk

Useful Header Parameters

App-DisplayName

A custom display name for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://app.testobject.com:443/api/storage/upload -H \
"Content-Type: application/octet-stream" -H \
"App-DisplayName: yourCustomDisplayName" --data-binary @your_app.apk


App-Identifer

A custom identifier for your app.

curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST \
https://app.testobject.com:443/api/storage/upload -H \
"Content-Type: application/octet-stream" -H \
"App-Identifier: identifier_for_your_app" --data-binary @your_app.apk

Check if App Already Exists

You can use a custom app identifier to to check if an app was already uploaded.

First, get all the apps for a specified MD5:

curl -u "your_username:your_api_key" -X GET \
https://app.testobject.com:443/api/storage/app?appIdentifier=MD5_hash_of_your_app

If the call returns an empty JSON array, start uploading the file:

curl -u "your_username:your_api_key" -X POST \
https://app.testobject.com:443/api/storage/upload -H \
"Content-Type: application/octet-stream" -H \
"App-Identifier: MD5_hash_of_your_app" --data-binary @your_app.apk




  • No labels