How to Retrieve Archive Log File from Device using API

Modified on Sun, Jun 14 at 2:58 PM

Overview

This API retrieves an archived log file from a device using an ADB pull command. Once the file is successfully retrieved, the API returns a downloadable URL that can be used to access the archived log file.

This API is commonly used after creating an archive using the Archive Logs on Device API.


Endpoint

URL: https://{your_base_url}.testgrid.io/api/execute-shell-adb-native/{device_id}

Method: POST

Request Parameters

ParameterTypeRequiredDescription
device_idIntegerYesUnique identifier of the target device
ParameterTypeRequiredDescription
user_tokenStringYesUser authentication token
commandStringYesADB pull command used to retrieve the archived log file

Example Request

curl --location 'https://{your_base_url}.testgrid.io/api/execute-shell-adb-native/1'
--form 'user_token="YOUR_USER_TOKEN"'
--form 'command="pull /sdcard/Android/data/com.android.numeracle.screencapture/files/CallCapture/CallCaptureLogs/mylogs_archive.tar.gz TGFileName=mylogs_archive.tar.gz"'


Example Response

{
"success": true,
"message": "Command executed successfully.",
"output": "/sdcard/Android/data/com.android.numeracle.screencapture/files/CallCapture/CallCaptureLogs/mylogs_archive.tar.gz: 1 file pulled, 0 skipped. 0.8 MB/s (997 bytes in 0.001s)",
"file_url": "https://{your_base_url}.testgrid.io/device-cloud/ADBFiles/Download/DEVICE_ID/mylogs_archive.tar.gz"
}


Response Parameters

ParameterTypeDescription
successBooleanIndicates whether the command executed successfully
messageStringStatus message returned after command execution
outputStringOutput generated by the ADB pull command
file_urlStringDownload URL for the retrieved archive file

Notes

  • Replace {device_id} with the target device ID.

  • The user_token must be valid and associated with the environment.

  • The API returns a downloadable URL only when the file is successfully retrieved.

  • Verify the file path in the command before execution.


Outcome

The API retrieves the specified archived log file from the target device and returns a downloadable URL, enabling users to collect and analyze device logs for troubleshooting, debugging, and automation reporting purposes.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article