curl --request POST \
--url https://api.example.com/automations/ \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"trigger": {
"type": "event",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"match": {},
"match_related": {},
"after": [
"<string>"
],
"expect": [
"<string>"
],
"for_each": [
"<string>"
],
"threshold": 1,
"within": 0
},
"actions": [
{
"type": "do-nothing"
}
],
"description": "",
"enabled": true,
"tags": [
"<string>"
],
"actions_on_trigger": [
{
"type": "do-nothing"
}
],
"actions_on_resolve": [
{
"type": "do-nothing"
}
],
"owner_resource": "<string>"
}
'import requests
url = "https://api.example.com/automations/"
payload = {
"name": "<string>",
"trigger": {
"type": "event",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"match": {},
"match_related": {},
"after": ["<string>"],
"expect": ["<string>"],
"for_each": ["<string>"],
"threshold": 1,
"within": 0
},
"actions": [{ "type": "do-nothing" }],
"description": "",
"enabled": True,
"tags": ["<string>"],
"actions_on_trigger": [{ "type": "do-nothing" }],
"actions_on_resolve": [{ "type": "do-nothing" }],
"owner_resource": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
trigger: {
type: 'event',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
match: {},
match_related: {},
after: ['<string>'],
expect: ['<string>'],
for_each: ['<string>'],
threshold: 1,
within: 0
},
actions: [{type: 'do-nothing'}],
description: '',
enabled: true,
tags: ['<string>'],
actions_on_trigger: [{type: 'do-nothing'}],
actions_on_resolve: [{type: 'do-nothing'}],
owner_resource: '<string>'
})
};
fetch('https://api.example.com/automations/', 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://api.example.com/automations/",
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([
'name' => '<string>',
'trigger' => [
'type' => 'event',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'match' => [
],
'match_related' => [
],
'after' => [
'<string>'
],
'expect' => [
'<string>'
],
'for_each' => [
'<string>'
],
'threshold' => 1,
'within' => 0
],
'actions' => [
[
'type' => 'do-nothing'
]
],
'description' => '',
'enabled' => true,
'tags' => [
'<string>'
],
'actions_on_trigger' => [
[
'type' => 'do-nothing'
]
],
'actions_on_resolve' => [
[
'type' => 'do-nothing'
]
],
'owner_resource' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/automations/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"trigger\": {\n \"type\": \"event\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"match\": {},\n \"match_related\": {},\n \"after\": [\n \"<string>\"\n ],\n \"expect\": [\n \"<string>\"\n ],\n \"for_each\": [\n \"<string>\"\n ],\n \"threshold\": 1,\n \"within\": 0\n },\n \"actions\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"description\": \"\",\n \"enabled\": true,\n \"tags\": [\n \"<string>\"\n ],\n \"actions_on_trigger\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"actions_on_resolve\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"owner_resource\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/automations/")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"trigger\": {\n \"type\": \"event\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"match\": {},\n \"match_related\": {},\n \"after\": [\n \"<string>\"\n ],\n \"expect\": [\n \"<string>\"\n ],\n \"for_each\": [\n \"<string>\"\n ],\n \"threshold\": 1,\n \"within\": 0\n },\n \"actions\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"description\": \"\",\n \"enabled\": true,\n \"tags\": [\n \"<string>\"\n ],\n \"actions_on_trigger\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"actions_on_resolve\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"owner_resource\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/automations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"trigger\": {\n \"type\": \"event\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"match\": {},\n \"match_related\": {},\n \"after\": [\n \"<string>\"\n ],\n \"expect\": [\n \"<string>\"\n ],\n \"for_each\": [\n \"<string>\"\n ],\n \"threshold\": 1,\n \"within\": 0\n },\n \"actions\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"description\": \"\",\n \"enabled\": true,\n \"tags\": [\n \"<string>\"\n ],\n \"actions_on_trigger\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"actions_on_resolve\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"owner_resource\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"trigger": {
"posture": "Reactive",
"type": "event",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"match": {},
"match_related": {},
"after": [
"<string>"
],
"expect": [
"<string>"
],
"for_each": [
"<string>"
],
"threshold": 1,
"within": 0
},
"actions": [
{
"type": "do-nothing"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z",
"description": "",
"enabled": true,
"tags": [
"<string>"
],
"actions_on_trigger": [
{
"type": "do-nothing"
}
],
"actions_on_resolve": [
{
"type": "do-nothing"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Automation
Create an automation.
For more information, see https://docs.prefect.io/v3/concepts/automations.
curl --request POST \
--url https://api.example.com/automations/ \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"trigger": {
"type": "event",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"match": {},
"match_related": {},
"after": [
"<string>"
],
"expect": [
"<string>"
],
"for_each": [
"<string>"
],
"threshold": 1,
"within": 0
},
"actions": [
{
"type": "do-nothing"
}
],
"description": "",
"enabled": true,
"tags": [
"<string>"
],
"actions_on_trigger": [
{
"type": "do-nothing"
}
],
"actions_on_resolve": [
{
"type": "do-nothing"
}
],
"owner_resource": "<string>"
}
'import requests
url = "https://api.example.com/automations/"
payload = {
"name": "<string>",
"trigger": {
"type": "event",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"match": {},
"match_related": {},
"after": ["<string>"],
"expect": ["<string>"],
"for_each": ["<string>"],
"threshold": 1,
"within": 0
},
"actions": [{ "type": "do-nothing" }],
"description": "",
"enabled": True,
"tags": ["<string>"],
"actions_on_trigger": [{ "type": "do-nothing" }],
"actions_on_resolve": [{ "type": "do-nothing" }],
"owner_resource": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
trigger: {
type: 'event',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
match: {},
match_related: {},
after: ['<string>'],
expect: ['<string>'],
for_each: ['<string>'],
threshold: 1,
within: 0
},
actions: [{type: 'do-nothing'}],
description: '',
enabled: true,
tags: ['<string>'],
actions_on_trigger: [{type: 'do-nothing'}],
actions_on_resolve: [{type: 'do-nothing'}],
owner_resource: '<string>'
})
};
fetch('https://api.example.com/automations/', 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://api.example.com/automations/",
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([
'name' => '<string>',
'trigger' => [
'type' => 'event',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'match' => [
],
'match_related' => [
],
'after' => [
'<string>'
],
'expect' => [
'<string>'
],
'for_each' => [
'<string>'
],
'threshold' => 1,
'within' => 0
],
'actions' => [
[
'type' => 'do-nothing'
]
],
'description' => '',
'enabled' => true,
'tags' => [
'<string>'
],
'actions_on_trigger' => [
[
'type' => 'do-nothing'
]
],
'actions_on_resolve' => [
[
'type' => 'do-nothing'
]
],
'owner_resource' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/automations/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"trigger\": {\n \"type\": \"event\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"match\": {},\n \"match_related\": {},\n \"after\": [\n \"<string>\"\n ],\n \"expect\": [\n \"<string>\"\n ],\n \"for_each\": [\n \"<string>\"\n ],\n \"threshold\": 1,\n \"within\": 0\n },\n \"actions\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"description\": \"\",\n \"enabled\": true,\n \"tags\": [\n \"<string>\"\n ],\n \"actions_on_trigger\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"actions_on_resolve\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"owner_resource\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/automations/")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"trigger\": {\n \"type\": \"event\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"match\": {},\n \"match_related\": {},\n \"after\": [\n \"<string>\"\n ],\n \"expect\": [\n \"<string>\"\n ],\n \"for_each\": [\n \"<string>\"\n ],\n \"threshold\": 1,\n \"within\": 0\n },\n \"actions\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"description\": \"\",\n \"enabled\": true,\n \"tags\": [\n \"<string>\"\n ],\n \"actions_on_trigger\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"actions_on_resolve\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"owner_resource\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/automations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"trigger\": {\n \"type\": \"event\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"match\": {},\n \"match_related\": {},\n \"after\": [\n \"<string>\"\n ],\n \"expect\": [\n \"<string>\"\n ],\n \"for_each\": [\n \"<string>\"\n ],\n \"threshold\": 1,\n \"within\": 0\n },\n \"actions\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"description\": \"\",\n \"enabled\": true,\n \"tags\": [\n \"<string>\"\n ],\n \"actions_on_trigger\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"actions_on_resolve\": [\n {\n \"type\": \"do-nothing\"\n }\n ],\n \"owner_resource\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"trigger": {
"posture": "Reactive",
"type": "event",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"match": {},
"match_related": {},
"after": [
"<string>"
],
"expect": [
"<string>"
],
"for_each": [
"<string>"
],
"threshold": 1,
"within": 0
},
"actions": [
{
"type": "do-nothing"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z",
"description": "",
"enabled": true,
"tags": [
"<string>"
],
"actions_on_trigger": [
{
"type": "do-nothing"
}
],
"actions_on_resolve": [
{
"type": "do-nothing"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Body
The name of this automation
A trigger that fires based on the presence or absence of events within a given period of time.
- EventTrigger
- CompoundTrigger
- SequenceTrigger
Show child attributes
Show child attributes
The actions to perform when this Automation triggers
Do nothing when an Automation is triggered
- DoNothing
- RunDeployment
- PauseDeployment
- ResumeDeployment
- CancelFlowRun
- DeleteFlowRun
- ChangeFlowRunState
- PauseWorkQueue
- ResumeWorkQueue
- SendNotification
- CallWebhook
- PauseAutomation
- ResumeAutomation
- SuspendFlowRun
- ResumeFlowRun
- PauseWorkPool
- ResumeWorkPool
Show child attributes
Show child attributes
A longer description of this automation
Whether this automation will be evaluated
A list of tags associated with this automation
The actions to perform when an Automation goes into a triggered state
Do nothing when an Automation is triggered
- DoNothing
- RunDeployment
- PauseDeployment
- ResumeDeployment
- CancelFlowRun
- DeleteFlowRun
- ChangeFlowRunState
- PauseWorkQueue
- ResumeWorkQueue
- SendNotification
- CallWebhook
- PauseAutomation
- ResumeAutomation
- SuspendFlowRun
- ResumeFlowRun
- PauseWorkPool
- ResumeWorkPool
Show child attributes
Show child attributes
The actions to perform when an Automation goes into a resolving state
Do nothing when an Automation is triggered
- DoNothing
- RunDeployment
- PauseDeployment
- ResumeDeployment
- CancelFlowRun
- DeleteFlowRun
- ChangeFlowRunState
- PauseWorkQueue
- ResumeWorkQueue
- SendNotification
- CallWebhook
- PauseAutomation
- ResumeAutomation
- SuspendFlowRun
- ResumeFlowRun
- PauseWorkPool
- ResumeWorkPool
Show child attributes
Show child attributes
The resource to which this automation belongs
Response
Successful Response
The name of this automation
A trigger that fires based on the presence or absence of events within a given period of time.
- EventTrigger
- CompoundTrigger
- SequenceTrigger
Show child attributes
Show child attributes
The actions to perform when this Automation triggers
Do nothing when an Automation is triggered
- DoNothing
- RunDeployment
- PauseDeployment
- ResumeDeployment
- CancelFlowRun
- DeleteFlowRun
- ChangeFlowRunState
- PauseWorkQueue
- ResumeWorkQueue
- SendNotification
- CallWebhook
- PauseAutomation
- ResumeAutomation
- SuspendFlowRun
- ResumeFlowRun
- PauseWorkPool
- ResumeWorkPool
Show child attributes
Show child attributes
A longer description of this automation
Whether this automation will be evaluated
A list of tags associated with this automation
The actions to perform when an Automation goes into a triggered state
Do nothing when an Automation is triggered
- DoNothing
- RunDeployment
- PauseDeployment
- ResumeDeployment
- CancelFlowRun
- DeleteFlowRun
- ChangeFlowRunState
- PauseWorkQueue
- ResumeWorkQueue
- SendNotification
- CallWebhook
- PauseAutomation
- ResumeAutomation
- SuspendFlowRun
- ResumeFlowRun
- PauseWorkPool
- ResumeWorkPool
Show child attributes
Show child attributes
The actions to perform when an Automation goes into a resolving state
Do nothing when an Automation is triggered
- DoNothing
- RunDeployment
- PauseDeployment
- ResumeDeployment
- CancelFlowRun
- DeleteFlowRun
- ChangeFlowRunState
- PauseWorkQueue
- ResumeWorkQueue
- SendNotification
- CallWebhook
- PauseAutomation
- ResumeAutomation
- SuspendFlowRun
- ResumeFlowRun
- PauseWorkPool
- ResumeWorkPool
Show child attributes
Show child attributes
Was this page helpful?