{
  "opencollection": "1.0.0",
  "info": {
    "name": "ThingsBoard Rule Engine API",
    "version": "4.3.0.3DEMO"
  },
  "items": [
    {
      "info": {
        "name": "rule-chain-controller",
        "type": "folder"
      },
      "items": [
        {
          "info": {
            "name": "Import Rule Chains",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChains/import",
            "params": [
              {
                "name": "overwrite",
                "value": "",
                "type": "query",
                "description": "Enables overwrite for existing rule chains with the same name."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Imports all tenant rule chains as one JSON.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Create or Update Rule Chain (saveRuleChain)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChain",
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error.\n\nThe rule chain object is lightweight and contains general information about the rule chain. Lis"
        },
        {
          "info": {
            "name": "Set Root Rule Chain (setRootRuleChain)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId/root",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Makes the rule chain to be root rule chain. Updates previous root rule chain as well. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId/edgeTemplateRoot",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Set Auto Assign to Edge Rule Chain (setAutoAssignToEdgeRuleChain)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId/autoAssignToEdge",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Unset Auto Assign to Edge Rule Chain (unsetAutoAssignToEdgeRuleChain)",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId/autoAssignToEdge",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Test Script Function",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChain/testScript",
            "params": [
              {
                "name": "scriptLang",
                "value": "",
                "type": "query",
                "description": "Script language: JS or TBEL"
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Execute the Script function and return the result. The format of request: \n\n```json\n{\n  \"script\": \"Your Function as String\",\n  \"scriptType\": \"One of: update, generate, filter, switch, json, string\",\n  \"argNames\": [\"msg\", \"metadata\", \"type\"],\n  \"msg\": \"{\\\"temperature\\\": 42}\", \n  \"metadata\": {\n    \"deviceName\": \"Device A\",\n    \"deviceType\": \"Thermometer\"\n  },\n  \"msgType\": \"POST_TELEMETRY_REQUEST\"\n}\n```\n\n Expected result JSON contains \"output\" and \"error\".\n\nAvailable for users with 'TENANT_ADMIN' a"
        },
        {
          "info": {
            "name": "Update Rule Chain Metadata",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChain/metadata",
            "params": [
              {
                "name": "updateRelated",
                "value": "",
                "type": "query",
                "description": "Update related rule nodes."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Create Default Rule Chain",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/ruleChain/device/default",
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Assign Rule Chain to Edge (assignRuleChainToEdge)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/edge/:edgeId/ruleChain/:ruleChainId",
            "params": [
              {
                "name": "edgeId",
                "value": "",
                "type": "path"
              },
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. \n\nOnly rule chain with type 'EDGE'"
        },
        {
          "info": {
            "name": "Unassign Rule Chain from Edge (unassignRuleChainFromEdge)",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://demo.thingsboard.io/api/edge/:edgeId/ruleChain/:ruleChainId",
            "params": [
              {
                "name": "edgeId",
                "value": "",
                "type": "path"
              },
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally.\n\nAvailable for users with 'TENANT_ADMIN' a"
        },
        {
          "info": {
            "name": "Get Latest Input Message (getLatestRuleNodeDebugInput)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleNode/:ruleNodeId/debugIn",
            "params": [
              {
                "name": "ruleNodeId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Get Rule Chains (getRuleChains)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChains",
            "params": [
              {
                "name": "ruleChainIds",
                "value": "",
                "type": "query",
                "description": "A list of rule chain ids, separated by comma ','"
              },
              {
                "name": "pageSize",
                "value": "",
                "type": "query",
                "description": "Maximum amount of entities in a one page"
              },
              {
                "name": "page",
                "value": "",
                "type": "query",
                "description": "Sequence number of page starting from 0"
              },
              {
                "name": "type",
                "value": "",
                "type": "query",
                "description": "Rule chain type (CORE or EDGE)"
              },
              {
                "name": "textSearch",
                "value": "",
                "type": "query",
                "description": "The case insensitive 'substring' filter based on the rule chain name."
              },
              {
                "name": "sortProperty",
                "value": "",
                "type": "query",
                "description": "Property of entity to sort by"
              },
              {
                "name": "sortOrder",
                "value": "",
                "type": "query",
                "description": "Sort order. ASC (ASCENDING) or DESC (DESCENDING)"
              }
            ]
          },
          "docs": "Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See response schema for more details. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Export Rule Chains",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChains/export",
            "params": [
              {
                "name": "limit",
                "value": "",
                "type": "query",
                "description": "A limit of rule chains to export."
              }
            ]
          },
          "docs": "Exports all tenant rule chains as one JSON.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Get Rule Chain (getRuleChainById)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Delete Rule Chain (deleteRuleChain)",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Get Rule Chain Output Labels (getRuleChainOutputLabels)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId/output/labels",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Get Output Labels Usage (getRuleChainOutputLabelsUsage)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId/output/labels/usage",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Get Rule Chain (getRuleChainById)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChain/:ruleChainId/metadata",
            "params": [
              {
                "name": "ruleChainId",
                "value": "",
                "type": "path",
                "description": "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ]
          },
          "docs": "Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Is TBEL Script Executor Enabled",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChain/tbelEnabled"
          },
          "docs": "Returns 'True' if the TBEL script execution is enabled\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Get Auto Assign to Edge Rule Chains (getAutoAssignToEdgeRuleChains)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/ruleChain/autoAssignToEdgeRuleChains"
          },
          "docs": "Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.\n\nAvailable for users with 'TENANT_ADMIN' authority."
        },
        {
          "info": {
            "name": "Get Edge Rule Chains (getEdgeRuleChains)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/edge/:edgeId/ruleChains",
            "params": [
              {
                "name": "edgeId",
                "value": "",
                "type": "path",
                "description": "A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              },
              {
                "name": "pageSize",
                "value": "",
                "type": "query",
                "description": "Maximum amount of entities in a one page"
              },
              {
                "name": "page",
                "value": "",
                "type": "query",
                "description": "Sequence number of page starting from 0"
              },
              {
                "name": "textSearch",
                "value": "",
                "type": "query",
                "description": "The case insensitive 'substring' filter based on the rule chain name."
              },
              {
                "name": "sortProperty",
                "value": "",
                "type": "query",
                "description": "Property of entity to sort by"
              },
              {
                "name": "sortOrder",
                "value": "",
                "type": "query",
                "description": "Sort order. ASC (ASCENDING) or DESC (DESCENDING)"
              }
            ]
          },
          "docs": "Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See response schema for more details. \n\nAvailable for users with 'TENANT_ADMIN' authority."
        }
      ]
    },
    {
      "info": {
        "name": "rule-engine-controller",
        "type": "folder"
      },
      "items": [
        {
          "info": {
            "name": "Push Entity Message to the Rule Engine (handleRuleEngineRequest)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/rule-engine/:entityType/:entityId",
            "params": [
              {
                "name": "entityType",
                "value": "",
                "type": "path",
                "description": "A string value representing the entity type. For example, 'DEVICE'"
              },
              {
                "name": "entityId",
                "value": "",
                "type": "path",
                "description": "A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields:\n\n * **'serviceId'** to identify the platform server that received the request;\n * **'requestUUID'** to identify the request and ro"
        },
        {
          "info": {
            "name": "Push Entity Message with Timeout to the Rule Engine (handleRuleEngineRequest)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/rule-engine/:entityType/:entityId/:timeout",
            "params": [
              {
                "name": "entityType",
                "value": "",
                "type": "path",
                "description": "A string value representing the entity type. For example, 'DEVICE'"
              },
              {
                "name": "entityId",
                "value": "",
                "type": "path",
                "description": "A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              },
              {
                "name": "timeout",
                "value": "",
                "type": "path",
                "description": "Timeout to process the request in milliseconds"
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields:\n\n * **'serviceId'** to identify the platform server that received the request;\n * **'requestUUID'** to identify the request and ro"
        },
        {
          "info": {
            "name": "Push Entity Message with Timeout and Specified Queue to the Rule Engine (handleRuleEngineRequest)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/rule-engine/:entityType/:entityId/:queueName/:timeout",
            "params": [
              {
                "name": "entityType",
                "value": "",
                "type": "path",
                "description": "A string value representing the entity type. For example, 'DEVICE'"
              },
              {
                "name": "entityId",
                "value": "",
                "type": "path",
                "description": "A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"
              },
              {
                "name": "queueName",
                "value": "",
                "type": "path",
                "description": "Queue name to process the request in the rule engine"
              },
              {
                "name": "timeout",
                "value": "",
                "type": "path",
                "description": "Timeout to process the request in milliseconds"
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields:\n\n * **'serviceId'** to identify the platform server that received the request;\n * **'requestUUID'** to identify the request and ro"
        },
        {
          "info": {
            "name": "Push User Message to the Rule Engine (handleRuleEngineRequest)",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://demo.thingsboard.io/api/rule-engine/",
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses current User Id ( the one which credentials is used to perform the request) as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields:\n\n * **'serviceId'** to identify the platform server that received the requ"
        }
      ]
    },
    {
      "info": {
        "name": "component-descriptor-controller",
        "type": "folder"
      },
      "items": [
        {
          "info": {
            "name": "Get Component Descriptors (getComponentDescriptorsByTypes)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/components",
            "params": [
              {
                "name": "componentTypes",
                "value": "",
                "type": "query",
                "description": "List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL)"
              },
              {
                "name": "ruleChainType",
                "value": "",
                "type": "query",
                "description": "Type of the Rule Chain"
              }
            ]
          },
          "docs": "Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to "
        },
        {
          "info": {
            "name": "Get Component Descriptors (getComponentDescriptorsByType)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/components/:componentType",
            "params": [
              {
                "name": "componentType",
                "value": "",
                "type": "path",
                "description": "Type of the Rule Node"
              },
              {
                "name": "ruleChainType",
                "value": "",
                "type": "query",
                "description": "Type of the Rule Chain"
              }
            ]
          },
          "docs": "Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors"
        },
        {
          "info": {
            "name": "Get Component Descriptor (getComponentDescriptorByClazz)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://demo.thingsboard.io/api/component/:componentDescriptorClazz",
            "params": [
              {
                "name": "componentDescriptorClazz",
                "value": "",
                "type": "path",
                "description": "Component Descriptor class name"
              }
            ]
          },
          "docs": "Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the "
        }
      ]
    }
  ],
  "bundled": true
}