Rules

Update a Rule

Update a rule by given Id to all nodes in the cluster

put/rules/{id}

Request

  • Base URL: https://docs.emqx.com/api/v5
  • URL: https://docs.emqx.com/api/v5/rules/{id}
  • Auth: one of:
    • HTTP basic
    • bearerAuth (a scheme the document does not define)

Path parameters

idstring required

Request body

namestring

The name of the rule

sqlstring required

<br/>SQL query to transform the messages.<br/>Example: <code>SELECT * FROM "test/topic" WHERE payload.x = 1</code><br/>

enableboolean

Enable or disable the rule

descriptionstring

The description of the rule

metadataobject

Rule metadata, do not change manually

Example request

{
  "name": "foo",
  "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
  "actions": [
    "webhook:my_webhook",
    {
      "args": {
        "payload": "${payload}",
        "topic": "t/1"
      },
      "function": "republish"
    },
    {
      "function": "console"
    }
  ],
  "description": "Some description",
  "metadata": {}
}

Response

idstring required

The ID of the rule

fromstring[]

The topics of the rule

created_atstring

The created time of the rule

namestring

The name of the rule

sqlstring required

<br/>SQL query to transform the messages.<br/>Example: <code>SELECT * FROM "test/topic" WHERE payload.x = 1</code><br/>

enableboolean

Enable or disable the rule

descriptionstring

The description of the rule

metadataobject

Rule metadata, do not change manually

Example response

{
  "id": "293fb66f",
  "created_at": "2021-12-01T15:00:43.153+08:00",
  "name": "foo",
  "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1",
  "actions": [
    "webhook:my_webhook",
    {
      "args": {
        "payload": "${payload}",
        "topic": "t/1"
      },
      "function": "republish"
    },
    {
      "function": "console"
    }
  ],
  "description": "Some description",
  "metadata": {}
}

Changes

No recorded changes to this operation across all 1 revision of this API.