Create a custom rule type
import requests
url = "https://{FUSION_HOST}/api/custom-rule-types"
payload = {
"id": "custom-rule-type",
"pipeline_id": "custom-rule-pipeline",
"display_type": "My Custom Rule",
"schema": {
"type": "object",
"properties": {
"custom_param1": {
"type": "string",
"title": "Manufacturer",
"description": "The manufacturer of the product this rule action applies to."
},
"custom_param2": {
"type": "string",
"title": "Type",
"description": "The type of product this rule action applies to."
}
}
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://{FUSION_HOST}/api/custom-rule-types")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"custom-rule-type\",\n \"pipeline_id\": \"custom-rule-pipeline\",\n \"display_type\": \"My Custom Rule\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"custom_param1\": {\n \"type\": \"string\",\n \"title\": \"Manufacturer\",\n \"description\": \"The manufacturer of the product this rule action applies to.\"\n },\n \"custom_param2\": {\n \"type\": \"string\",\n \"title\": \"Type\",\n \"description\": \"The type of product this rule action applies to.\"\n }\n }\n }\n}")
.asString();const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'custom-rule-type',
pipeline_id: 'custom-rule-pipeline',
display_type: 'My Custom Rule',
schema: {
type: 'object',
properties: {
custom_param1: {
type: 'string',
title: 'Manufacturer',
description: 'The manufacturer of the product this rule action applies to.'
},
custom_param2: {
type: 'string',
title: 'Type',
description: 'The type of product this rule action applies to.'
}
}
}
})
};
fetch('https://{FUSION_HOST}/api/custom-rule-types', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION_HOST}/api/custom-rule-types")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"custom-rule-type\",\n \"pipeline_id\": \"custom-rule-pipeline\",\n \"display_type\": \"My Custom Rule\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"custom_param1\": {\n \"type\": \"string\",\n \"title\": \"Manufacturer\",\n \"description\": \"The manufacturer of the product this rule action applies to.\"\n },\n \"custom_param2\": {\n \"type\": \"string\",\n \"title\": \"Type\",\n \"description\": \"The type of product this rule action applies to.\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION_HOST}/api/custom-rule-types"
payload := strings.NewReader("{\n \"id\": \"custom-rule-type\",\n \"pipeline_id\": \"custom-rule-pipeline\",\n \"display_type\": \"My Custom Rule\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"custom_param1\": {\n \"type\": \"string\",\n \"title\": \"Manufacturer\",\n \"description\": \"The manufacturer of the product this rule action applies to.\"\n },\n \"custom_param2\": {\n \"type\": \"string\",\n \"title\": \"Type\",\n \"description\": \"The type of product this rule action applies to.\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION_HOST}/api/custom-rule-types",
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([
'id' => 'custom-rule-type',
'pipeline_id' => 'custom-rule-pipeline',
'display_type' => 'My Custom Rule',
'schema' => [
'type' => 'object',
'properties' => [
'custom_param1' => [
'type' => 'string',
'title' => 'Manufacturer',
'description' => 'The manufacturer of the product this rule action applies to.'
],
'custom_param2' => [
'type' => 'string',
'title' => 'Type',
'description' => 'The type of product this rule action applies to.'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://{FUSION_HOST}/api/custom-rule-types \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "custom-rule-type",
"pipeline_id": "custom-rule-pipeline",
"display_type": "My Custom Rule",
"schema": {
"type": "object",
"properties": {
"custom_param1": {
"type": "string",
"title": "Manufacturer",
"description": "The manufacturer of the product this rule action applies to."
},
"custom_param2": {
"type": "string",
"title": "Type",
"description": "The type of product this rule action applies to."
}
}
}
}
'{
"id": "<string>",
"display_type": "<string>",
"pipeline_id": "<string>",
"schema": {
"additionalProperties": {},
"category": "<string>",
"categoryPriority": 123,
"default": "<string>",
"definitions": {},
"description": "<string>",
"enum": [
{}
],
"hints": [
"<string>"
],
"maxProperties": 123,
"minProperties": 123,
"oneOf": [
{
"type": "string",
"title": "<string>",
"description": "<string>",
"default": "<string>",
"category": "<string>",
"categoryPriority": 123,
"hints": [
"<string>"
],
"unsafe": true,
"oneOf": [
{
"type": "string",
"title": "<string>",
"description": "<string>",
"default": {},
"category": "<string>",
"categoryPriority": 123,
"hints": [
"<string>"
],
"unsafe": true
}
]
}
],
"properties": {},
"propertyGroups": [
{
"label": "<string>",
"properties": [
"<string>"
]
}
],
"required": [
"<string>"
],
"title": "<string>",
"type": "array",
"unsafe": true
}
}Create a custom rule type
The request is a JSON body defining the new custom rule type.
POST
/
custom-rule-types
Create a custom rule type
import requests
url = "https://{FUSION_HOST}/api/custom-rule-types"
payload = {
"id": "custom-rule-type",
"pipeline_id": "custom-rule-pipeline",
"display_type": "My Custom Rule",
"schema": {
"type": "object",
"properties": {
"custom_param1": {
"type": "string",
"title": "Manufacturer",
"description": "The manufacturer of the product this rule action applies to."
},
"custom_param2": {
"type": "string",
"title": "Type",
"description": "The type of product this rule action applies to."
}
}
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://{FUSION_HOST}/api/custom-rule-types")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"custom-rule-type\",\n \"pipeline_id\": \"custom-rule-pipeline\",\n \"display_type\": \"My Custom Rule\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"custom_param1\": {\n \"type\": \"string\",\n \"title\": \"Manufacturer\",\n \"description\": \"The manufacturer of the product this rule action applies to.\"\n },\n \"custom_param2\": {\n \"type\": \"string\",\n \"title\": \"Type\",\n \"description\": \"The type of product this rule action applies to.\"\n }\n }\n }\n}")
.asString();const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'custom-rule-type',
pipeline_id: 'custom-rule-pipeline',
display_type: 'My Custom Rule',
schema: {
type: 'object',
properties: {
custom_param1: {
type: 'string',
title: 'Manufacturer',
description: 'The manufacturer of the product this rule action applies to.'
},
custom_param2: {
type: 'string',
title: 'Type',
description: 'The type of product this rule action applies to.'
}
}
}
})
};
fetch('https://{FUSION_HOST}/api/custom-rule-types', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION_HOST}/api/custom-rule-types")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"custom-rule-type\",\n \"pipeline_id\": \"custom-rule-pipeline\",\n \"display_type\": \"My Custom Rule\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"custom_param1\": {\n \"type\": \"string\",\n \"title\": \"Manufacturer\",\n \"description\": \"The manufacturer of the product this rule action applies to.\"\n },\n \"custom_param2\": {\n \"type\": \"string\",\n \"title\": \"Type\",\n \"description\": \"The type of product this rule action applies to.\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION_HOST}/api/custom-rule-types"
payload := strings.NewReader("{\n \"id\": \"custom-rule-type\",\n \"pipeline_id\": \"custom-rule-pipeline\",\n \"display_type\": \"My Custom Rule\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"custom_param1\": {\n \"type\": \"string\",\n \"title\": \"Manufacturer\",\n \"description\": \"The manufacturer of the product this rule action applies to.\"\n },\n \"custom_param2\": {\n \"type\": \"string\",\n \"title\": \"Type\",\n \"description\": \"The type of product this rule action applies to.\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION_HOST}/api/custom-rule-types",
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([
'id' => 'custom-rule-type',
'pipeline_id' => 'custom-rule-pipeline',
'display_type' => 'My Custom Rule',
'schema' => [
'type' => 'object',
'properties' => [
'custom_param1' => [
'type' => 'string',
'title' => 'Manufacturer',
'description' => 'The manufacturer of the product this rule action applies to.'
],
'custom_param2' => [
'type' => 'string',
'title' => 'Type',
'description' => 'The type of product this rule action applies to.'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://{FUSION_HOST}/api/custom-rule-types \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "custom-rule-type",
"pipeline_id": "custom-rule-pipeline",
"display_type": "My Custom Rule",
"schema": {
"type": "object",
"properties": {
"custom_param1": {
"type": "string",
"title": "Manufacturer",
"description": "The manufacturer of the product this rule action applies to."
},
"custom_param2": {
"type": "string",
"title": "Type",
"description": "The type of product this rule action applies to."
}
}
}
}
'{
"id": "<string>",
"display_type": "<string>",
"pipeline_id": "<string>",
"schema": {
"additionalProperties": {},
"category": "<string>",
"categoryPriority": 123,
"default": "<string>",
"definitions": {},
"description": "<string>",
"enum": [
{}
],
"hints": [
"<string>"
],
"maxProperties": 123,
"minProperties": 123,
"oneOf": [
{
"type": "string",
"title": "<string>",
"description": "<string>",
"default": "<string>",
"category": "<string>",
"categoryPriority": 123,
"hints": [
"<string>"
],
"unsafe": true,
"oneOf": [
{
"type": "string",
"title": "<string>",
"description": "<string>",
"default": {},
"category": "<string>",
"categoryPriority": 123,
"hints": [
"<string>"
],
"unsafe": true
}
]
}
],
"properties": {},
"propertyGroups": [
{
"label": "<string>",
"properties": [
"<string>"
]
}
],
"required": [
"<string>"
],
"title": "<string>",
"type": "array",
"unsafe": true
}
}Authorizations
Basic authAPI key
Body
application/json
Response
200 - application/json
OK
Was this page helpful?