Testsigma supports uploading Files to the Uploads section using REST API. One of the most prominent use case for this is updating the already uploaded app with the latest build or updating a test file periodically without manual process.


New File Upload API

Here's a sample format for the new Upload API:

Request Format - cURL

curl -u "<username>:<password>" -X POST http://app.testsigma.com/rest/storage/upload -H "Content-Type=multipart/form-data" -F "app=@</path/to/the/apkfile.apk>" 
-F 'data={
"name": "<app_name>",
"type": "<file_type>",
"version": "<version_name>",
"project": "<Project_name>"
};type = application/json'

Request Format - Postman

URL: https://app.testsigma.com/rest/storage/upload

Request Body type: form-data

Body:
{
app: <Select file from filesystem>
data: {"name": "file name","type": "Attachment","version":"version number","project": "Project Name"};type = application/json
}


Parameters Explanation

  • The login details for your Testsigma Account need to be specified in <username>:<password>
  • The API endpoint for the REST Call
http://app.testsigma.com/rest/storage/upload
  • The location of the file to be uploaded is given by the 'app' parameter. The '@' symbol needs to be a prefix to the file path. It will throw an error if the file is not present or accesible.
  • The name of the file can be given in the 'name' parameter.
  • The extension or type of the file can be given in the 'type' parameter(ipa, apk, or Attachment)
  • The version of the file can be given in the 'version' parameter(Optional)
  • The Project under which the file is to be uploaded needs to be specified as 'project' parameter. It will throw an error if an existing project with the provided name is not available.

Response Format

{
  "id": < id > ,
  "createdBy": null,
  "createdDate": < created_date > ,
  "updatedBy": < name > ,
  "updatedDate": < name > ,
  "active": 1,
  "projectId": < project_id > ,
  "name": "<upload_name>",
  "appPath": "<server_file_path>",
  "fileName": < file_name > ,
  "type": 1,
  "version": "<version_name>",
  "testsigmaAppId": "<testsigma_app_id>",
  "browserstackAppId": < id > ,
  "sauselabsAppId": < sauce_id > ,
  "platformType": < platform_id > ,
  "isPublic": null,
  "uploadStatus": 1,
  "comments": null,
  "message": "<message>",
  "status": 1,
  "nameFromApp": null,
  "versionFromApp": null,
  "fileSize": < uploaded_file_size >
}


The "testsigmaAppId" is the most important value in this response and we need to use it for further updations to the file.



Update File API

Here's a sample format for the API to update existing files:

Request Format - cURL

curl -u "<username>:<password>" -X PUT http://app.testsigma.com/rest/storage/upload/<id> -H "Content-Type=multipart/form-data" -F "app=@</path/to/the/apkfile.apk>" -F 'data=
{
"name": "<app_name>",
"version": "<version_name>",
"project": "<Project_name>"
}
;type = application/json'

Request Format - Postman

URL: https://app.testsigma.com/rest/storage/upload/<id>

Request Body type: form-data

Body:
{
app: Select file
data: {"name": "file name","type": "Attachment","version":"version number","project": "Project Name"};type = application/json
}


Parameters:

  • The login details for your Testsigma Account - <username>:<password>
  • The API endpoint for the REST Calls where <id> denotes App ID for the previously uploaded file. The "testsigmaAppId" from the response of file upload can be used here.
http://app.testsigma.com/rest/storage/upload/<id>
  • The location of the file to be uploaded is given by the 'app' parameter. The '@' needs to be prepended to the file path
  • The name of the file can be given in the 'name' parameter.
  • The version of the file can be given in the 'version' parameter.
  • The Project under which the file is to be uploaded needs to be specified as 'project' parameter. It will throw an error if an existing project with the provided name is not available.

Response Format

{
  "id": < id > ,
  "createdBy": null,
  "createdDate": < created_date > ,
  "updatedBy": < name > ,
  "updatedDate": < name > ,
  "active": 1,
  "projectId": < project_id > ,
  "name": "<upload_name>",
  "appPath": "<server_file_path>",
  "fileName": < file_name > ,
  "type": 1,
  "version": "<version_name>",
  "testsigmaAppId": "<testsigma_id>",
  "browserstackAppId": < id > ,
  "sauselabsAppId": < sauce_id > ,
  "platformType": < platform_id > ,
  "isPublic": null,
  "uploadStatus": 1,
  "comments": null,
  "message": "<message>",
  "status": 1,
  "nameFromApp": null,
  "versionFromApp": null,
  "fileSize": < uploaded_file_size >
}