curl --request POST \
--url https://app.miget.com/api/v1/apps/{uuid}/cronjobs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"command": "<string>",
"schedule_type": "interval",
"cron": "<string>",
"daily_time": "<string>",
"minute": "<string>",
"hour": "<string>",
"size": "<string>",
"max_run_seconds": 123
}
'import requests
url = "https://app.miget.com/api/v1/apps/{uuid}/cronjobs"
payload = {
"label": "<string>",
"command": "<string>",
"schedule_type": "interval",
"cron": "<string>",
"daily_time": "<string>",
"minute": "<string>",
"hour": "<string>",
"size": "<string>",
"max_run_seconds": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
label: '<string>',
command: '<string>',
schedule_type: 'interval',
cron: '<string>',
daily_time: '<string>',
minute: '<string>',
hour: '<string>',
size: '<string>',
max_run_seconds: 123
})
};
fetch('https://app.miget.com/api/v1/apps/{uuid}/cronjobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.miget.com/api/v1/apps/{uuid}/cronjobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'label' => '<string>',
'command' => '<string>',
'schedule_type' => 'interval',
'cron' => '<string>',
'daily_time' => '<string>',
'minute' => '<string>',
'hour' => '<string>',
'size' => '<string>',
'max_run_seconds' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.miget.com/api/v1/apps/{uuid}/cronjobs"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"command\": \"<string>\",\n \"schedule_type\": \"interval\",\n \"cron\": \"<string>\",\n \"daily_time\": \"<string>\",\n \"minute\": \"<string>\",\n \"hour\": \"<string>\",\n \"size\": \"<string>\",\n \"max_run_seconds\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.miget.com/api/v1/apps/{uuid}/cronjobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"command\": \"<string>\",\n \"schedule_type\": \"interval\",\n \"cron\": \"<string>\",\n \"daily_time\": \"<string>\",\n \"minute\": \"<string>\",\n \"hour\": \"<string>\",\n \"size\": \"<string>\",\n \"max_run_seconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/apps/{uuid}/cronjobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"command\": \"<string>\",\n \"schedule_type\": \"interval\",\n \"cron\": \"<string>\",\n \"daily_time\": \"<string>\",\n \"minute\": \"<string>\",\n \"hour\": \"<string>\",\n \"size\": \"<string>\",\n \"max_run_seconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"label": "<string>",
"schedule_type": "<string>",
"interval_type": "<string>",
"hour": "<string>",
"minute": "<string>",
"cron_expression": "<string>",
"command": "<string>",
"size": "<string>",
"overage": "<string>",
"max_run_seconds": 123,
"suspended": true,
"status": "<string>",
"last_job_name": "<string>",
"last_job_status": "<string>",
"last_job_run_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Create a cron job
Creates a new scheduled cron job for the application. Jobs can run on a fixed interval or using a custom cron expression. Cron jobs are billed for the time their runs take, at their size: one set to bill, or on a resource whose plan costs nothing, starts Usage Billing, and if it would be the first charge in a workspace whose subscription pays for nothing yet it is refused with 422 and a checkout_url to complete first, and in a workspace in its free trial the trial carries on: it covers the plan only: runs are charged while it runs, the first time once usage reaches $5, and usage never ends it. On a resource the runs draw on the cron minutes its plan includes first (cron_minutes on GET /api/v1/resources/); one created set to pause while they are used up starts paused (suspended: true) until the next renewal.
curl --request POST \
--url https://app.miget.com/api/v1/apps/{uuid}/cronjobs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"command": "<string>",
"schedule_type": "interval",
"cron": "<string>",
"daily_time": "<string>",
"minute": "<string>",
"hour": "<string>",
"size": "<string>",
"max_run_seconds": 123
}
'import requests
url = "https://app.miget.com/api/v1/apps/{uuid}/cronjobs"
payload = {
"label": "<string>",
"command": "<string>",
"schedule_type": "interval",
"cron": "<string>",
"daily_time": "<string>",
"minute": "<string>",
"hour": "<string>",
"size": "<string>",
"max_run_seconds": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
label: '<string>',
command: '<string>',
schedule_type: 'interval',
cron: '<string>',
daily_time: '<string>',
minute: '<string>',
hour: '<string>',
size: '<string>',
max_run_seconds: 123
})
};
fetch('https://app.miget.com/api/v1/apps/{uuid}/cronjobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.miget.com/api/v1/apps/{uuid}/cronjobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'label' => '<string>',
'command' => '<string>',
'schedule_type' => 'interval',
'cron' => '<string>',
'daily_time' => '<string>',
'minute' => '<string>',
'hour' => '<string>',
'size' => '<string>',
'max_run_seconds' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.miget.com/api/v1/apps/{uuid}/cronjobs"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"command\": \"<string>\",\n \"schedule_type\": \"interval\",\n \"cron\": \"<string>\",\n \"daily_time\": \"<string>\",\n \"minute\": \"<string>\",\n \"hour\": \"<string>\",\n \"size\": \"<string>\",\n \"max_run_seconds\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.miget.com/api/v1/apps/{uuid}/cronjobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"command\": \"<string>\",\n \"schedule_type\": \"interval\",\n \"cron\": \"<string>\",\n \"daily_time\": \"<string>\",\n \"minute\": \"<string>\",\n \"hour\": \"<string>\",\n \"size\": \"<string>\",\n \"max_run_seconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/apps/{uuid}/cronjobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"command\": \"<string>\",\n \"schedule_type\": \"interval\",\n \"cron\": \"<string>\",\n \"daily_time\": \"<string>\",\n \"minute\": \"<string>\",\n \"hour\": \"<string>\",\n \"size\": \"<string>\",\n \"max_run_seconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"label": "<string>",
"schedule_type": "<string>",
"interval_type": "<string>",
"hour": "<string>",
"minute": "<string>",
"cron_expression": "<string>",
"command": "<string>",
"size": "<string>",
"overage": "<string>",
"max_run_seconds": 123,
"suspended": true,
"status": "<string>",
"last_job_name": "<string>",
"last_job_status": "<string>",
"last_job_run_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Authorizations
Body
Create a cron job
A size code from GET /api/v1/apps/{uuid}/cronjobs/sizes, e.g. hobby-1c-1g: the CPU and RAM each run gets, billed for the time each run takes whether the app is on a resource or on Usage Billing. Sizes follow the app's CPU class; defaults to the smallest with at least the app's RAM, the largest if none has that much.
What the cron job does once its resource's cron minutes for the billing cycle are used up: 'pause' (the default) until the next renewal, which resumes it, or 'bill', each run past them billed by the second at its size's price on Usage Billing. Choosing 'bill' needs apps:manage and starts Usage Billing's $5 monthly minimum when the subscription pays for nothing else (422 with a checkout_url to complete first). Only where the resource has cron minutes (cron_minutes on GET /api/v1/resources/{uuid}) and is not on an enterprise contract; elsewhere it is ignored: on Usage Billing or a plan that costs nothing every run is billed, and a contract's cron jobs pause at its limit.
pause, bill Response
Create a cron job
Api_V1_Entities_Cronjob model
What a run past its resource's cron minutes does: 'pause' until the next renewal, or 'bill', billed by the second. Always 'bill' on Usage Billing or a plan that costs nothing, which include no cron minutes, and 'pause' on an enterprise contract with a cron minute limit; null where its runs are not billed (an enterprise contract without a limit, a resource exempted from billing on a plan that costs nothing, the workspace pool)

