Skip to main content

Preview cron

POST/api/automation/rules/cron-preview
Administrator

A schedule and a reminder take only the actions that tell people something — Slack, email, and Microsoft Teams: nobody is watching when they go off. A schedule takes its project from the release it repeats. Preview next run on the page, or POST /api/automation/rules/cron-preview, says when an expression would next fire before any rule keeps it.

Read more: RulesSource: AutomationRuleApiController#previewCron(opens in new tab)

Request body​

application/json

FieldTypeRequiredNotes
cronExpressionstringRequired
cronTimeZonestringRequired

Response​

Success: 200

FieldTypeRequiredNotes
nextFireAtstring (date-time)Optional

Errors​

StatusCodeApplies to
400validation_faileda field is missing or out of rangeAny endpoint
400malformed_requestthe body cannot be readAny endpoint
400invalid_parametera path or query parameter is missing or does not convert, such as an ID that is not a UUIDAny endpoint
401authentication_requiredno sessionAny endpoint
403access_deniedan administrator endpoint, or a missing or stale CSRF tokenAny endpoint
404not_foundno such addressAny endpoint
405method_not_allowedthe address does not take that methodAny endpoint
415unsupported_media_typethe address does not read a body of that typeAny endpoint
500internal_errora fault ReleaseFlow did not foresee; the body never carries the exception behind itAny endpoint
400, 404, 409See the guideAutomation area

Request

bash
# Sign in first and keep the session cookie in cookies.txt (see Sessions and CSRF).
# CSRF_HEADER and CSRF_TOKEN are the headerName and token GET /api/csrf returned.
curl -X POST "http://localhost:8080/api/automation/rules/cron-preview" \
-b cookies.txt -c cookies.txt \
-H "$CSRF_HEADER: $CSRF_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"cronExpression": "<string>",
"cronTimeZone": "<string>"
}'

The request body is an example built from the schema; replace every placeholder.

Response

200

Example

{
  "nextFireAt": "<date-time>"
}