This page describes retrieving old batch run results in as much detail as possible using MagicPod Web API. Following the procedure, users can keep test results before being deleted due to the data retention policy (It will be effective from October 1, 2025). We assume you have already learned how to use MagicPod Web API.
Precaution
As mentioned on this page, MagicPod Web API has a rate limit. Please call APIs at reasonable intervals.
Example
This section describes an example of how to call APIs. Please replace <ORGANIZATION_NAME>, <PROJECT_NAME> and <MAGICPOD_API_TOKEN> based on your environment.
Get a batch run list
This API call retrieves the latest 20 batch runs.
curl -X 'GET' \ '<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-runs/?count=20' \ -H 'accept: application/json' \ -H 'Authorization: Token <MAGICPOD_API_TOKEN>'
By specifying min_batch_run_number or max_batch_run_number, an arbitrary range of batch runs is retrieved.
# Retrieve 1-20 curl -X 'GET' \ '<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-runs/?count=20&min_batch_run_number=1' \ -H 'accept: application/json' \ -H 'Authorization: Token <MAGICPOD_API_TOKEN>' # Retrieve 1981-2000 curl -X 'GET' \ '<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-runs/?count=20&max_batch_run_number=2000' \ -H 'accept: application/json' \ -H 'Authorization: Token <MAGICPOD_API_TOKEN>'
The response contains the timestamp finished_at for each batch run. By checking this value, you can know which batch run results will be deleted by the data retention policy.
{
"batch_run_number": 2000,
"test_setting_name": "[Daily] Android",
"branch_name": "main",
"status": "succeeded",
"status_number": 1,
"started_at": "2023-01-01T18:17:42Z",
**"finished_at": "2023-01-01T18:54:45Z",**
"duration_seconds": 2223.041385,
"test_cases": {
"succeeded": 30,
"total": 30
},
"url": "<https://app.magicpod.com/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-run/2000/",
"executed_via": "web_api",
"executed_by": "user-x"
}
Get a single batch run result
You can get a single batch run result using the batch_run_number retrieved in the previous section. To get failures and notes, please specify errors=true¬e=true.
curl -X 'GET' \ '<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-run/20000/?errors=true¬e=true' \ -H 'accept: application/json' \ -H 'Authorization: Token <MAGICPOD_API_TOKEN>'
Each test case’s result is output under results property. Here, you can see the test case’s status, failure message, executed timestamp, etc. If such basic information is enough, you can stop here.
{
"organization_name": "<ORGANIZATION_NAME>",
"project_name": "<PROJECT_NAME>",
"batch_run_number": 2000,
...
"results": [
{
"order": 1,
"test_case": {
"number": 11,
"name": "SmokeTest",
"url": "<https://app.magicpod.com/><ORGANIZATION_NAME>/<PROJECT_NAME>/11/",
"step_count": 3
},
"number": 11,
"status": "failed",
"started_at": "2023-01-01T19:02:54Z",
"finished_at": "2023-01-01T19:07:07Z",
"duration_seconds": 252.253078,
"data_patterns": null,
"note": null,
"errors": [
{
"step_number": "12",
"failure_type": "failure",
"message": "UI element \\"Finish\\" is not found (id=finish)",
"status": null,
"loop_number": ""
}
],
"test_run_log_url": "<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-run/2000/1/1/1/test-run-log/",
"test_engine_log_url": "<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-run/2000/1/1/1/test-engine-log/",
"device_log_url": "<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-run/2000/1/1/1/device-log/"
},
[Optional] Get logs for each test result
You can get test logs for each test result using **_url properties obtained in the previous section. There are three types of logs. test_run_log and test_engine_log exist for almost all test results, but device_log does not exist unless you specify to keep it.
You can use the pre-defined file name or an arbitrary file name to save the log.
# Get test_run_log with the default file name test_run.log
curl -X 'GET' \ '<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-run/2000/1/1/1/test-run-log/' \ -H 'accept: application/json' \ -H 'Authorization: Token <MAGICPOD_API_TOKEN>' -J -O # Get test_engine_log with a specified file name curl -X 'GET' \ '<https://app.magicpod.com/api/v1.0/><ORGANIZATION_NAME>/<PROJECT_NAME>/batch-run/2000/1/1/1/test-engine-log/' \ -H 'accept: application/json' \ -H 'Authorization: Token <MAGICPOD_API_TOKEN>' --output <FILE_NAME>
[Optional] Get screenshots of a batch run
You can download screenshots of a batch run. Please see this page for details.