Description: Get the worker's run history.
Since: 7.90
Security: Admin user.
Usage: GET /worker/api/v1/execution_history
Produces: application/json; charset=utf-8
Header parameter: Authorization: Bearer
Sample Request
{ "workerKey": string, "showTestRun": boolean }
Request Parameters
Parameter | Datatype | Mandatory | Description |
---|---|---|---|
workerKey | string | No | If set, it will only return the execution history for the given worker |
showTestRun | boolean | No | If true, the test runs will also be returned. Test runs are the ones triggered by a user using the Run button in the Workers online editor or using the Worker Execute Test API. The default value is false. |
Sample Usage
curl -X GET 'https://myserver.com/worker/api/v1/execution_history'
Sample Response
[ { "workerKey": "my-worker", "executionStatus": "STATUS_SUCCESS", "workerType": "beforeDownload", "executionPayload": {...}, "executionResult": { "result": {...}, "logs": "[info ] - Log line 1\n[info ] - Log line 2\n", "workerStats": { "cpuTimeMillis": 10, "topMemoryUsageBytes": 59352936, "executionDurationMillis": 22 } }, "startTimeMillis": 1715942153944, "endTimeMillis": 1715942154018, "triggeredBy": "artifactory" }, ... ]
Response Parameters
Parameter | Datatype | Description |
---|---|---|
workerKey | string | The name of the worker (unique ID). |
workerType | Action | The action on which the worker is hooked. It is an enum string of Action Enum (see below for available values). |
executionStatus | string | Can be either |
executionPayload | object | null | Forevent driven workers this will be an object containing data about the event that triggered the worker. For manual (http request) workers, it will contain the data passed in the body of the HTTP request. Can be null if the body is not defined. |
executionResult.result | object | Contains what the worker returned. In case of an uncaught exception, the |
executionResult.logs | string | Containing the worker’s script logs output. |
executionResult.workerStats.cpuTimeMillis | number | The total calculation time performed by the worker’s script. |
executionResult.workersStats.topMemoryUsageBytes | number | The top memory usage for this worker. |
executionResult.workerStats.executionDurationMillis | number | The total execution time. |
startTimeMillis | number | The time by which the execution started in milliseconds. |
endTimeMillis | number | The time by which the execution ended in milliseconds. |
triggeredBy | number | Specifies who or what triggered the worker. For a test run using the Run button in the online Workers editor, the value is For event-driven workers, the service name that triggered the worker is provided. For Generic Event Workers, the value is the username. |
Error Response
If there is an execution failure, executionResult.result.message
will contain the error message, executionResult.result.logs
will be an empty string and executionResult.result.workerStats
will be an empty object.
[ { "workerKey": "my-worker", "executionStatus": "STATUS_FAIL", "workerType": "beforeDownload", "executionPayload": {...}, "executionResult": { "result": { message: "An error occurred: reason…" }, "logs": "", "workerStats": {} }, "startTimeMillis": 1715942153944, "endTimeMillis": 1715942154018, "triggeredBy": "artifactory" }, ... ]
Success Response Codes:
200: OK response. The execution history returned successfully.
Error Response Codes:
401 Invalid credentials.
403 Insufficient permissions.
409 Conflict with workerKey
. Either the worker does not exist (if the workerKey
query parameter is set) or the history storage is not connected.