Overview
This API allows users to remove all log files from a specified device by executing an ADB shell command. It is commonly used to clean up application logs before or after test execution, ensuring a fresh environment for subsequent testing activities.
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 used to delete the log directory |
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 rm -r /sdcard/Android/data/com.android.numeracle.screencapture/files/CallCapture/CallCaptureLogs"'
Example Response
{
"success": true,
"message": "Command executed successfully.",
"output": "",
"file_url": ""
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the command executed successfully |
| message | String | Status message returned after command execution |
| output | String | Output generated by the command execution |
| file_url | String | Generated file URL, if applicable |
Notes
Replace
{device_id}with the target device ID.The
user_tokenmust be valid and authorized to access the device.The API executes the specified shell command directly on the device.
Exercise caution when modifying the command parameter, as incorrect commands may delete unintended files or directories.
The log directory path is application-specific and may vary across applications or versions.
Outcome
The API removes all log files from the specified device directory, helping maintain a clean test environment and preventing older log data from impacting future troubleshooting or automation activities.
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