Skip to main content
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_body
package 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": [
      {
        "title": "<string>",
        "description": "<string>",
        "default": "<string>",
        "category": "<string>",
        "categoryPriority": 123,
        "hints": [
          "<string>"
        ],
        "unsafe": true,
        "oneOf": [
          {
            "title": "<string>",
            "description": "<string>",
            "default": {},
            "category": "<string>",
            "categoryPriority": 123,
            "hints": [
              "<string>"
            ],
            "unsafe": true
          }
        ]
      }
    ],
    "properties": {},
    "propertyGroups": [
      {
        "label": "<string>",
        "properties": [
          "<string>"
        ]
      }
    ],
    "required": [
      "<string>"
    ],
    "title": "<string>",
    "unsafe": true
  }
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Query Parameters

context
string

The app to which this object belongs, as app:SomeApp.

Body

application/json
id
string

The custom rule type ID. This value must be unique across all apps in Fusion (global namespace).

display_type
string

A user-friendly name for the custom rule type.

pipeline_id
string

The ID of the pipeline that is invoked during rule processing.

schema
Object Type · object

Represents a structured object type definition used in the Experience Manager.

Response

200 - application/json

OK

id
string

The custom rule type ID. This value must be unique across all apps in Fusion (global namespace).

display_type
string

A user-friendly name for the custom rule type.

pipeline_id
string

The ID of the pipeline that is invoked during rule processing.

schema
Object Type · object

Represents a structured object type definition used in the Experience Manager.