Skip to main content

List cronjob executions belonging to a cronjob

GET/v2/cronjobs/{cronjobId}/executions
API version
v2
Request method
GET
Operation ID
cronjob-list-executions

Request​

  • cronjobIdstringrequired

    ID of the Cronjob for which to list CronjobExecutions for.

Responses​

Response headers
  • X-Pagination-Limitinteger

    The limit used to select the resources for the response

  • X-Pagination-Pagenumber

    The calculate page of the list response. Refer to parameters to learn more.

  • X-Pagination-Skipinteger

    The number of skipped items

  • X-Pagination-TotalCountinteger

    The total amount of items available in the remote ressource. Use this value in combination with the limit to calculate the available pages.

Format
application/json
Description

OK

  • Array[
    • *object
      • abortedByobject
        • idstring (uuid)
      • cronjobIdstringrequired
      • durationInMillisecondsinteger (int64)
      • endstring (date-time)
      • executionEndstring (date-time)deprecated
      • executionStartstring (date-time)deprecated
      • exitCodeinteger (int32)
      • idstringrequired
      • logPathstring
      • startstring (date-time)
      • statusstring (one of: Complete, Failed, AbortedBySystem, Pending, Running, AbortedByUser, TimedOut)required
      • successfulbooleanrequired
      • triggeredByobject
        • idstring (uuid)
    ]
Content-Type: application/json

[
{
"abortedBy": {
"id": "f0f86186-0a5a-45b2-aa33-502777496347"
},
"cronjobId": "string",
"durationInMilliseconds": 12374,
"end": "1985-10-26T01:21:00.000Z",
"exitCode": 123,
"id": "cron-bd26li-28027320",
"logPath": "/var/log/cronjobs/cron-bd26li-28027320.log",
"start": "1985-10-26T01:21:00.000Z",
"status": "Complete",
"successful": true,
"triggeredBy": {
"id": "f0f86186-0a5a-45b2-aa33-502777496347"
}
}
]
{
"items": {
"properties": {
"abortedBy": {
"properties": {
"id": {
"format": "uuid",
"type": "string"
}
},
"type": "object"
},
"cronjobId": {
"type": "string"
},
"durationInMilliseconds": {
"example": 12374,
"format": "int64",
"type": "integer"
},
"end": {
"format": "date-time",
"type": "string"
},
"executionEnd": {
"deprecated": true,
"format": "date-time",
"type": "string"
},
"executionStart": {
"deprecated": true,
"format": "date-time",
"type": "string"
},
"exitCode": {
"example": 0,
"format": "int32",
"type": "integer"
},
"id": {
"example": "cron-bd26li-28027320",
"type": "string"
},
"logPath": {
"example": "/var/log/cronjobs/cron-bd26li-28027320.log",
"type": "string"
},
"start": {
"format": "date-time",
"type": "string"
},
"status": {
"enum": [
"Complete",
"Failed",
"AbortedBySystem",
"Pending",
"Running",
"AbortedByUser",
"TimedOut"
],
"type": "string"
},
"successful": {
"type": "boolean"
},
"triggeredBy": {
"properties": {
"id": {
"format": "uuid",
"type": "string"
}
},
"type": "object"
}
},
"required": [
"id",
"status",
"successful",
"cronjobId"
],
"type": "object"
},
"type": "array"
}

Usage examples​

$ curl \
--fail \
--location \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
https://api.mittwald.de/v2/cronjobs/string/executions?since=1985-10-26T01%3A21%3A00.000Z&until=1985-10-26T01%3A21%3A00.000Z&status=Complete&triggeredByUser=true&sortOrder=oldestFirst&limit=50&page=1
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.cronjob.listExecutions({
"cronjobId": "string",
"queryParameters": {
"since": "1985-10-26T01:21:00.000Z",
"until": "1985-10-26T01:21:00.000Z",
"status": "Complete",
"triggeredByUser": true,
"sortOrder": "oldestFirst",
"limit": 50,
"page": 1
}
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\Cronjob\ListExecutions\ListExecutionsRequest;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

$request = (new ListExecutionsRequest(
cronjobId: "string"
))
->withSince("1985-10-26T01:21:00.000Z")
->withUntil("1985-10-26T01:21:00.000Z")
->withStatus("Complete")
->withTriggeredByUser(true)
->withSortOrder("oldestFirst")
->withLimit(50)
->withPage(1);
$response = $client->cronjob()->listExecutions($request);

var_dump($response->getBody();

On this page