Create rule
curl --request POST \
--url http://localhost:3000/v2/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": {},
"kind": "automation"
}
'import requests
url = "http://localhost:3000/v2/rules"
payload = {
"name": "<string>",
"description": {},
"kind": "automation"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: {}, kind: 'automation'})
};
fetch('http://localhost:3000/v2/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v2/rules",
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>',
'description' => [
],
'kind' => 'automation'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:3000/v2/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": {},\n \"kind\": \"automation\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:3000/v2/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": {},\n \"kind\": \"automation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v2/rules")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": {},\n \"kind\": \"automation\"\n}"
response = http.request(request)
puts response.read_body{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"name": "<string>",
"kind": "<string>",
"environments": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"name": "<string>",
"kind": "production",
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"versionId": "<string>"
}
],
"versions": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"versionNumber": 123,
"status": "<string>",
"graph": {
"nodes": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"config": {}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"handle": "<string>",
"label": "<string>"
}
]
},
"viewport": {
"x": 123,
"y": 123,
"zoom": 123
},
"compileStatus": "<string>",
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"stateMachineArn": "<string>",
"definitionHash": "<string>",
"compileError": "<string>",
"publishedAt": "2023-11-07T05:31:56Z"
}
],
"ruleVersions": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"sequence": 123,
"message": "<string>",
"documents": [
{
"id": "<string>",
"name": "<string>",
"type": "event",
"content": {},
"description": "<string>"
}
],
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
}
}
],
"tests": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"documentId": "<string>",
"name": "<string>",
"input": {},
"expectedOutput": {},
"status": "<string>",
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"lastRunVersionId": "<string>",
"lastRunOutput": {},
"lastRunAt": "2023-11-07T05:31:56Z"
}
],
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"description": "<string>",
"activeVersionId": "<string>"
}rules
Create rule
POST
/
v2
/
rules
Create rule
curl --request POST \
--url http://localhost:3000/v2/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": {},
"kind": "automation"
}
'import requests
url = "http://localhost:3000/v2/rules"
payload = {
"name": "<string>",
"description": {},
"kind": "automation"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: {}, kind: 'automation'})
};
fetch('http://localhost:3000/v2/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v2/rules",
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>',
'description' => [
],
'kind' => 'automation'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:3000/v2/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": {},\n \"kind\": \"automation\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:3000/v2/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": {},\n \"kind\": \"automation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v2/rules")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": {},\n \"kind\": \"automation\"\n}"
response = http.request(request)
puts response.read_body{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"name": "<string>",
"kind": "<string>",
"environments": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"name": "<string>",
"kind": "production",
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"versionId": "<string>"
}
],
"versions": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"versionNumber": 123,
"status": "<string>",
"graph": {
"nodes": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"config": {}
}
],
"edges": [
{
"id": "<string>",
"source": "<string>",
"target": "<string>",
"handle": "<string>",
"label": "<string>"
}
]
},
"viewport": {
"x": 123,
"y": 123,
"zoom": 123
},
"compileStatus": "<string>",
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"stateMachineArn": "<string>",
"definitionHash": "<string>",
"compileError": "<string>",
"publishedAt": "2023-11-07T05:31:56Z"
}
],
"ruleVersions": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"sequence": 123,
"message": "<string>",
"documents": [
{
"id": "<string>",
"name": "<string>",
"type": "event",
"content": {},
"description": "<string>"
}
],
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
}
}
],
"tests": [
{
"object": "page",
"id": "p_abc123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"ruleId": "<string>",
"documentId": "<string>",
"name": "<string>",
"input": {},
"expectedOutput": {},
"status": "<string>",
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"lastRunVersionId": "<string>",
"lastRunOutput": {},
"lastRunAt": "2023-11-07T05:31:56Z"
}
],
"createdBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"updatedBy": {
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
},
"description": "<string>",
"activeVersionId": "<string>"
}Authorizations
OAuth2 Authorization Code flow
Body
application/json
Response
200 - application/json
Object type
Example:
"page"
Unique identifier
Example:
"p_abc123"
Creation timestamp
Example:
"2024-01-15T10:30:00.000Z"
Last update timestamp
Example:
"2024-01-15T14:45:00.000Z"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Principal who created this object
Show child attributes
Show child attributes
Example:
{
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
}
Principal who last updated this object
Show child attributes
Show child attributes
Example:
{
"object": "user",
"id": "u_abc123",
"apiKeyId": "bsk_abc123"
}
⌘I