Overview
This API allows users to execute an ADB shell command on a device to archive log files or perform other shell-based operations. It is commonly used to compress and package device logs into an archive that can later be downloaded and analyzed for troubleshooting purposes.
Endpoint
URL: https://{your_base_url}.testgrid.io/api/execute-shell-adb-native/{device_id}
Method: POST
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| device_id | Integer | Yes | Unique identifier of the target device |
| Parameter | Type | Required | Description |
|---|---|---|---|
| user_token | String | Yes | User authentication token |
| command | String | Yes | Shell command to execute on the device |
Example Request
curl --location 'https://{your_base_url}.testgrid.io/api/execute-shell-adb-native/1'
--form 'user_token="YOUR_USER_TOKEN"'
--form 'command="shell tar -czvf sdcard/Android/data/com.android.numeracle.screencapture/files/CallCapture/CallCaptureLogs/mylogs_archive.tar.gz sdcard/Android/data/com.android.numeracle.screencapture/files/CallCapture/CallCaptureLogs"'
Example Response
{
"success": true,
"message": "Command executed successfully.",
"output": "sdcard/Android/data/com.android.numeracle.screencapture/files/CallCapture/CallCaptureLogs/\nsdcard/Android/data/com.android.numeracle.screencapture/files/CallCapture/CallCaptureLogs/Callcapture_app_logs.txt\ntar: 'mylogs_archive.tar.gz' file is the archive; not dumped\ntar: had errors",
"file_url": ""
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the command executed successfully |
| message | String | Result of the command execution |
| output | String | Standard output generated by the shell command |
| file_url | String | URL of the generated archive file, if available |
Notes
The API executes shell commands directly on the specified device.
Ensure that the target device is online and accessible before sending the request.
The command output may contain warnings or errors generated by the underlying shell command.
The file_url field remains empty if archive creation fails.
Verify that the provided device_id corresponds to the intended device.
A valid user_token is required for authentication.
Outcome
The API executes the specified shell command on the target device and returns the command output. When archive creation is successful, the resulting archive can be used for log collection, troubleshooting, debugging, and analysis purposes.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article