File Storage API Methods

Use the Storage API methods to upload and manage your application and any file dependencies required for testing.

Refer to Getting Started for Authentication and Server information.

Get App Storage Files#

GET /v1/storage/files

Returns the set of files that have been uploaded to Sauce Storage by the requestor.

Parameters#

q

| QUERY | OPTIONAL | STRING |

Any search term (such as build number or file name) by which you want to filter results.

kind

| QUERY | OPTIONAL | STRING |

The application type associated with the file, such as android or ios.

file_id

| QUERY | OPTIONAL | ARRAY of STRINGS |

One or more specific IDs of the files to return.

team_id

| QUERY | OPTIONAL | ARRAY of STRINGS |

One or more IDs of teams with which the files are shared.

page

| QUERY | OPTIONAL | INTEGER |

Return results beginning with a specific page. Default is 1.

per_page

| QUERY | OPTIONAL | STRING |

The maximum number of results to show per page.

Sample Request
curl --location --request GET 'https://api.us-west-1.saucelabs.com/v1/storage/files' \
--header 'Authorization: Basic $SAUCE_USERNAME:$SAUCE_ACCESS_KEY' \

Responses#

200Success.
404Not found.
Sample Response
{
"items": [
{
"id": "43732d5b-5275-4a79-a936-197e4b9cd2d4",
"owner": {
"id": "e5be7513ba224f6f9463c209cb4c5d83",
"org_id": "bed0a8a559404117b3d10d3bfff4c8ab"
},
"name": "iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa",
"upload_timestamp": 1618522437,
"etag": "184d1c399251e8849edcb0adfc079571",
"kind": "ios",
"group_id": 64612,
"description": null,
"metadata": {
"identifier": "com.saucelabs.SwagLabsMobileApp",
"name": "SwagLabsMobileApp",
"version": "12",
"is_test_runner": false,
"icon": "...",
"short_version": "2.7.1",
"is_simulator": false,
"min_os": "10.0",
"target_os": "14.2",
"test_runner_plugin_path": null
},
"access": {
"team_ids": [
"80d69d16ebdb4c018cc9d81ea911761a"
],
"org_ids": []
}
}
],
"links": {...},
"page": 1,
"per_page": 25,
"total_items": 1
}

Get App Storage Groups#

GET /v1/storage/groups

Returns an array of groups (applications containing multiple files) currently in storage for the authenticated requestor.

Parameters#

q

| QUERY | OPTIONAL | STRING |

Any search term (such as build number or file name) by which you want to filter results.

kind

| QUERY | OPTIONAL | STRING |

The application type associated with the group, such as android or ios.

group_id

| QUERY | OPTIONAL | ARRAY of STRINGS |

One or more specific IDs of the groups to return.

page

| QUERY | OPTIONAL | INTEGER |

Return results beginning with a specific page. Default is 1.

per_page

| QUERY | OPTIONAL | STRING |

The maximum number of results to show per page.

Sample Request
curl --location --request GET 'https://api.us-west-1.saucelabs.com/v1/storage/groups' \
--header 'Authorization: Basic $SAUCE_USERNAME:$SAUCE_ACCESS_KEY' \

Responses#

200Success.
404Not found.
Sample Response
{
"items": [
{
"id": 64612,
"name": "com.saucelabs.SwagLabsMobileApp",
"recent": {
"id": "43732d5b-5275-4a79-a936-197e4b9cd2d4",
"owner": {
"id": "e5be7513ba224f6f9463c209cb4c5d83",
"org_id": "bed0a8a559404117b3d10d3bfff4c8ab"
},
"name": "iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa",
"upload_timestamp": 1618522437,
"etag": "184d1c399251e8849edcb0adfc079571",
"kind": "ios",
"group_id": 64612,
"description": null,
"metadata": {
"identifier": "com.saucelabs.SwagLabsMobileApp",
"name": "SwagLabsMobileApp",
"version": "12",
"is_test_runner": false,
"icon": "...",
"short_version": "2.7.1",
"is_simulator": false,
"min_os": "10.0",
"target_os": "14.2",
"test_runner_plugin_path": null
},
"access": {
"team_ids": [
"80d69d16ebdb4c018cc9d81ea911761a"
],
"org_ids": []
}
}
"count": 1,
"access": {...},
"settings": {
"proxy": {
"host": "",
"port": 0
},
"proxy_enabled": false,
"lang": "en_GB",
"orientation": null,
"resigning_enabled": true,
"resigning": {
"image_injection": true,
"group_directory": false,
"biometrics": true,
"sys_alerts_delay": false
}
}
}
],
"links": {...},
"page": 1,
"per_page": 25,
"total_items": 1
}

Upload File to App Storage#

POST /v1/storage/upload

Uploads an application file to Sauce Storage for the purpose of mobile application testing and returns a unique file ID assigned to the app. Sauce Storage supports app files in .APK, .IPA, or *.ZIP format, up to 4GB.

Parameters#

payload

| FORM-FILE | REQUIRED | STRING |

The path to the file you want to upload.

name

| FORM-TEXT | REQUIRED | STRING |

The portion of the payload value that is the actual file name (including the type extension).

Sample Request
curl --location --request POST 'https://api.us-west-1.saucelabs.com/v1/storage/upload' \
--header 'Authorization: Basic $SAUCE_USERNAME:$SAUCE_ACCESS_KEY' \
--form 'payload=@"g16K4P8IX/iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa"' \
--form 'name="iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa"'

Responses#

201Created.
400Bad Request.
404Not found.
Sample Response
{
"item": {
"id": "7a154f05-835f-469a-93cf-880647d3a8ab",
"owner": {
"id": "******",
"org_id": "******"
},
"name": "iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa",
"upload_timestamp": 1619035533,
"etag": "184d1c399251e8849edcb0adfc079571",
"kind": "ios",
"group_id": 64612,
"description": null,
"metadata": {
"identifier": "com.saucelabs.SwagLabsMobileApp",
"name": "SwagLabsMobileApp",
"version": "12",
"is_test_runner": false,
"icon": "...",
"short_version": "2.7.1",
"is_simulator": false,
"min_os": "10.0",
"target_os": "14.2",
"test_runner_plugin_path": null
},
"access": {...}
}
}

Download a File from App Storage#

GET /v1/storage/download/{file_id}

Returns an application file from Sauce Storage as a payload object in the response.

Parameters#

file_id

| PATH | REQUIRED | STRING |

The Sauce Labs identifier of the stored file. You can look up file IDs using the Get App Storage Files endpoint.

Sample Request
curl --location --request GET 'https://api.us-west-1.saucelabs.com/v1/storage/download/43732d5b-5275-4a79-a936-197e4b9cd2d4' \
--header 'Authorization: Basic $SAUCE_USERNAME:$SAUCE_ACCESS_KEY' \

Responses#

200Success.
404Not found.
Sample Response
PK
(BwQPayload/UX �a�_�a�_�PK
*BwQPayload/SwagLabsMobileApp.app/UX �a�_b�_�PK
(BwQ-Payload/SwagLabsMobileApp.app/_CodeSignature/UX �a�_�a�_�PK*BwQ:Payload/SwagLabsMobileApp.app/_CodeSignature/CodeResourcesUX �a�_�a�_��}i��H����_QS�3#ؼ$�Zt��x��(R�$�m�oR"���+�]6%R.WX, ��+���$3##"#����,����MT���~���;���߾�5�����/�7J"��LWQ~'�ā#�����2��Ҩ���j�=d}����ö-�'����֧O}t���@��ҫ������ ����1̏����n�����k�
...

Edit a Stored File's Description#

PUT /v1/storage/files/{file_id}

Adds or updates the description attribute of the specified file.

Parameters#

file_id

| PATH | REQUIRED | STRING |

The Sauce Labs identifier of the stored file. You can look up file IDs using the Get App Storage Files endpoint.

description

| BODY | REQUIRED | STRING |

A description to more clearly distinguish the stored file within the Sauce Labs system.

Sample Request
curl --location --request PUT 'https://api.us-west-1.saucelabs.com/v1/storage/files/43732d5b-5275-4a79-a936-197e4b9cd2d4' \
--header 'Authorization: Basic $SAUCE_USERNAME:$SAUCE_ACCESS_KEY' \
--header 'Content-Type: text/html' \
--data-raw '{
"item": {
"description": "Sauce Docs iOS Test App"
}
}'\

Responses#

200Success.
400Bad Request.
404Not found.
Sample Response
{
"item": {
"id": "43732d5b-5275-4a79-a936-197e4b9cd2d4",
"owner": {
"id": "e5be7513ba224f6f9463c209cb4c5d83",
"org_id": "bed0a8a559404117b3d10d3bfff4c8ab"
},
"name": "iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa",
"upload_timestamp": 1618522437,
"etag": "184d1c399251e8849edcb0adfc079571",
"kind": "ios",
"group_id": 64612,
"description": "Sauce Docs iOS Test App",
"metadata": {
"identifier": "com.saucelabs.SwagLabsMobileApp",
"name": "SwagLabsMobileApp",
"version": "12",
"is_test_runner": false,
"icon": "...",
"short_version": "2.7.1",
"is_simulator": false,
"min_os": "10.0",
"target_os": "14.2",
"test_runner_plugin_path": null
},
"access": {...}
},
"changed": true
}

Delete an App Storage File#

DELETE /v1/storage/files/{file_id}

Deletes the specified file from Sauce Storage.

Parameters#

file_id

| PATH | REQUIRED | STRING |

The Sauce Labs identifier of the stored file. You can look up file IDs using the Get App Storage Files endpoint.

Sample Request
curl --location --request DELETE 'https://api.us-west-1.saucelabs.com/v1/storage/files/43732d5b-5275-4a79-a936-197e4b9cd2d4' \
--header 'Authorization: Basic $SAUCE_USERNAME:$SAUCE_ACCESS_KEY' \

Responses#

200Success.
404Not found.
Sample Response
{
"item": {
"id": "43732d5b-5275-4a79-a936-197e4b9cd2d4",
"owner": {
"id": "e5be7513ba224f6f9463c209cb4c5d83",
"org_id": "bed0a8a559404117b3d10d3bfff4c8ab"
},
"name": "iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa",
"upload_timestamp": 1618522437,
"etag": "184d1c399251e8849edcb0adfc079571",
"kind": "ios",
"group_id": 64612,
"description": "Sauce Docs iOS Test App",
"metadata": {
"identifier": "com.saucelabs.SwagLabsMobileApp",
"name": "SwagLabsMobileApp",
"version": "12",
"is_test_runner": false,
"icon": "...",
"short_version": "2.7.1",
"is_simulator": false,
"min_os": "10.0",
"target_os": "14.2",
"test_runner_plugin_path": null
},
"access": {...}
}
}

Delete a Group of App Storage Files#

DELETE /v1/storage/files/{group_id}

Deletes the specified group of files from Sauce Storage.

Parameters#

group_id

| PATH | REQUIRED | STRING |

The Sauce Labs identifier of the group of files. You can look up file IDs using the Get App Storage Groups endpoint.

Sample Request
curl --location --request DELETE 'https://api.us-west-1.saucelabs.com/v1/storage/groups/64612' \
--header 'Authorization: Basic $SAUCE_USERNAME:$SAUCE_ACCESS_KEY' \

Responses#

200Success.
404Not found.
Sample Response
{
"code": 404,
"title": "NotFound",
"detail": "The group identified by \"64612\" does not exist or is not accessible (Request ID: nancy.swee__delete_group__35803e43)"
}

Last updated on by Nancy Sweeney