Checking an execution
When the automation runs in the background — or when it went past the budget of waiting for the result — the call returns an exec_uuid and the run carries on. This route is how you follow it and pick up the result later.
GET https://mwm.datallog.com/api/v4/execution/<exec_uuid>/status
Authorization: Token <YOUR_TOKEN>
X-Api-Key: <YOUR_X_API_KEY>The response
{
"exec_uuid": "0199c2f1-7a3b-7e41-9f0a-3c5d2b8e6a11",
"finished": true,
"error": false,
"stopped": false,
"container_error": false,
"result_url": "https://…",
"logs_url": "https://…"
}| Field | What it says |
|---|---|
finished | the run is over (with or without an error) |
error | the automation raised an error |
stopped | someone stopped the run from the dashboard |
container_error | the container died before the automation answered |
result_url | link to download the result, or null |
logs_url | link to download the log, or null |
Both links last 1 minute
result_url and logs_url are signed addresses valid for 60 seconds, and they only appear once finished is true — and only when the automation is set to keep the result and the log. Download them as soon as you get them; to fetch again, call the route again.
Polling until it is done
import time, requests
HEADERS = {"Authorization": f"Token {TOKEN}", "X-Api-Key": KEY}
url = f"https://mwm.datallog.com/api/v4/execution/{exec_uuid}/status"
while True:
state = requests.get(url, headers=HEADERS).json()
if state["finished"]:
break
time.sleep(5)
if state["error"] or state["container_error"]:
print("it failed; the log is at", state["logs_url"])
else:
print(requests.get(state["result_url"]).json())Wait between calls. The run you are following does not go faster for being asked more often, and every check is an API call like any other.
An execution that does not exist, or belongs to another account, answers 404 with {"error": "Execution not found"} — the same answer in both cases, on purpose.