hosting
POST /v1/sites/{siteId}/scheduled-tasks
Schedule a command on a site.
Autenticación
Envía una clave de API como token de portador. La clave debe tener el permiso sites.view; una clave que no lo tenga se rechazará con un código 403, no 404.
Este endpoint no requiere ningún id de organización. Su clave ya identifica la organización a la que pertenece, y la respuesta está delimitada a ella.
Pruébalo
Reemplaza cualquier elemento entre corchetes angulares por tus propios valores, y el marcador de posición key con una clave de tu panel de control.
curl -X POST https://api.zinndigital.com/v1/sites/{siteId}/scheduled-tasks \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "schedule": <string>, "command": <string> }'¿Has iniciado sesión? La consola de la API en tu panel de control rellena el ID de tu organización real y tu propia clave, y ejecuta la solicitud contra la API en vivo para que puedas ver la respuesta real. Abre este endpoint en la consola de la API
Detalles
Adds one cron job. The schedule and the command are validated **before** the vendor is called: a five- or six-field crontab expression, no newline anywhere (a crontab is lines, so one embedded newline is a second job the customer never wrote), and a command within the length the vendor's crond accepts. Each refusal is a `422` carrying our sentence and naming the fix. ⛔ `enabled` is accepted for symmetry with `updateSiteScheduledTask` and **ignored here** — a newly created task is always active. Pause it with a subsequent `updateSiteScheduledTask` carrying the whole row. `404` for a site with no managed hosting package. Requires `sites.view` and `sites.panel_access`.
Parámetros
| Nombre | Tipo | Obligatorio | ¿Qué es esto? |
|---|---|---|---|
siteId (path) | Uuid | Sí | Site ID (UUIDv7). |
Cuerpo de la solicitud
| Nombre | Tipo | Obligatorio | ¿Qué es esto? |
|---|---|---|---|
schedule | string | Sí | A five- or six-field crontab expression. Validated before the vendor is called; ⛔ a newline anywhere in it is refused, because a crontab is lines and one embedded newline is a s… |
command | string | Sí | The command to run. Capped at the length the vendor's crond accepts — anything longer belongs in a script file the task then schedules. |
email_output | string | No | Where to mail the task's output. An email address, or empty to mail it nowhere — which is why this carries no `format: email`: the empty string is a valid value here and a forma… |
enabled | boolean | No | Whether the task runs. ⛔ Honoured by `updateSiteScheduledTask` and **ignored by `createSiteScheduledTask`** — a newly created task is always active, and pausing one is a subsequ… |
Respuesta
| Nombre | Tipo | Obligatorio | ¿Qué es esto? |
|---|---|---|---|
id | string | Sí | The task's identifier at the vendor, used to update or delete it. |
schedule | string | Sí | The crontab expression, carried **verbatim**. A customer who typed `*/15 * * * *` sees exactly that back, never a normalised rewriting of it. |
command | string | Sí | The command the vendor runs, as the site's own user. |
enabled | boolean | Sí | Whether the task currently runs. ⛔ An absent vendor flag reads as `false`, never `true` — reporting a paused job as running is how a customer stops investigating the thing that… |
email_output | string | Sí | Where the task's output is mailed, or `""` when the vendor mails it nowhere. |
Errores que este endpoint puede devolver
401 · 403 · 404 · 409 · 422 · 429 · 503