API REFERENCE
Rules
Update rules
5 min
{ "name" "update rules", "method" "put", "url" "https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules", "description" "update the rules set of monitor", "tab" "examples", "examples" { "languages" \[ { "id" "hqgiwh9mezfpd 2jojloe", "language" "curl", "code" "curl location globoff request put 'https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}' \\\\\n header 'authorization string' \\\\\n data '{\n \\"rule\\" \n {\n \\"relation\\" \\"and\\",\n \\"children\\" \n \[\n {\n \\"field\\" \\"balance increase\\",\n \\"value\\" 12,\n \\"operator\\" \\">=\\"\n },\n {\n \\"field\\" \\"balance amount\\",\n \\"value\\" 12,\n \\"operator\\" \\">=\\"\n }\n ]\n }\n}'", "customlabel" "" }, { "id" "raniaspyuryuprjaddtvf", "language" "nodejs", "code" "var request = require('request');\nvar options = {\n 'method' 'put',\n 'url' 'https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}',\n 'headers' {\n 'authorization' 'string'\n },\n body '{\\"rules\\" \\"array\\"}'\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "customlabel" "" }, { "id" "xp70f0iv11mzc9ks9ykqf", "language" "javascript", "code" "var myheaders = new headers();\nmyheaders append(\\"authorization\\", \\"string\\");\n\nvar raw = \\"{\\\\\\"rules\\\\\\" \\\\\\"array\\\\\\"}\\";\n\nvar requestoptions = {\n method 'put',\n headers myheaders,\n body raw,\n redirect 'follow'\n};\n\nfetch(\\"https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}\\", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));", "customlabel" "" }, { "id" "kjsknyxzibqchstdng9rj", "language" "python", "code" "import requests\n\nurl = \\"https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}\\"\n\npayload = \\"{\\\\\\"rules\\\\\\" \\\\\\"array\\\\\\"}\\"\nheaders = {\n 'authorization' 'string'\n}\n\nresponse = requests request(\\"put\\", url, headers=headers, data=payload)\n\nprint(response text)\n", "customlabel" "" }, { "id" "sw8nnjbsn fn nxi7e2y3", "language" "ruby", "code" "require \\"uri\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}\\")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http put new(url)\nrequest\[\\"authorization\\"] = \\"string\\"\nrequest body = \\"{\\\\\\"rules\\\\\\" \\\\\\"array\\\\\\"}\\"\n\nresponse = https request(request)\nputs response read body\n", "customlabel" "" }, { "id" "f eltkhap xtzng5nft", "language" "curl", "code" "curl location globoff request put 'https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}' \\\\\n header 'authorization string' \\\\\n data '{\\"rules\\" {\\"type\\" \\"string\\",\\"value\\" \\"number\\"}}'", "customlabel" "" }, { "id" "gjus9qtq0oinjvfl0clyd", "language" "nodejs", "code" "var request = require('request');\nvar options = {\n 'method' 'put',\n 'url' 'https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}',\n 'headers' {\n 'authorization' 'string'\n },\n body '{\\"rules\\" {\\"type\\" \\"string\\",\\"value\\" \\"number\\"}}'\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "customlabel" "" }, { "id" "jwryjd6yiclfbqibqm4ar", "language" "javascript", "code" "var myheaders = new headers();\nmyheaders append(\\"authorization\\", \\"string\\");\n\nvar raw = \\"{\\\\\\"rules\\\\\\" {\\\\\\"type\\\\\\" \\\\\\"string\\\\\\",\\\\\\"value\\\\\\" \\\\\\"number\\\\\\"}}\\";\n\nvar requestoptions = {\n method 'put',\n headers myheaders,\n body raw,\n redirect 'follow'\n};\n\nfetch(\\"https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}\\", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));", "customlabel" "" }, { "id" "4sqymjspqdvolfymfcv6o", "language" "python", "code" "import requests\n\nurl = \\"https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}\\"\n\npayload = \\"{\\\\\\"rules\\\\\\" {\\\\\\"type\\\\\\" \\\\\\"string\\\\\\",\\\\\\"value\\\\\\" \\\\\\"number\\\\\\"}}\\"\nheaders = {\n 'authorization' 'string'\n}\n\nresponse = requests request(\\"put\\", url, headers=headers, data=payload)\n\nprint(response text)\n", "customlabel" "" }, { "id" "bo nfipbqgv4ykozra3bk", "language" "ruby", "code" "require \\"uri\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //api sandbox klavi ai/monitor/v1/monitors/{id}/rules/{id}\\")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http put new(url)\nrequest\[\\"authorization\\"] = \\"string\\"\nrequest body = \\"{\\\\\\"rules\\\\\\" {\\\\\\"type\\\\\\" \\\\\\"string\\\\\\",\\\\\\"value\\\\\\" \\\\\\"number\\\\\\"}}\\"\n\nresponse = https request(request)\nputs response read body\n", "customlabel" "" } ], "selectedlanguageid" "hqgiwh9mezfpd 2jojloe" }, "results" { "languages" \[ { "id" "iiztz4zh7mdqlhfgvcaug", "language" "200", "customlabel" "", "code" "{\n\t\\"message\\" \\"ok\\"\n}" } ], "selectedlanguageid" "iiztz4zh7mdqlhfgvcaug" }, "request" { "pathparameters" \[ { "name" "id", "kind" "required", "type" "string", "description" "id of the monitor", "" "id of the monitor" } ], "queryparameters" \[], "headerparameters" \[ { "name" "authorization", "kind" "required", "type" "string", "description" "bearer access token, it returned by the /auth", "" "bearer access token, it returned by the /auth" } ], "bodydataparameters" \[ { "name" "rule", "kind" "required", "type" "object", "description" "monitor rule", "" "monitor rule", "children" \[ { "name" "relation", "kind" "required", "type" "string", "description" "the elements in the list currently only support and" }, { "name" "children", "kind" "required", "type" "array", "description" "field list", "children" \[ { "name" "parameter name", "kind" "optional", "type" "string", "description" "" } ] } ], "schema" \[ { "name" "relation", "kind" "required", "type" "string", "description" "the elements in the list currently only support and" }, { "name" "children", "kind" "required", "type" "array", "description" "field list", "children" \[ { "name" "parameter name", "kind" "optional", "type" "string", "description" "" } ] } ] } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" }, "hastryitout" false } parameter children field currently only supports monitoring balance related indicators, including balance amount and balance increase operator comparison operator, currently only supports >=, != value amount, numeric type rule field operator value balance amount >=, != if operator is equal to >=, then value can only be a number if operator is equal to !=, then value can only be null balance increase >= only numbers body example single field { "rule" { "relation" "and", "children" \[ { "field" "balance increase", "value" 12, "operator" ">=" } ] } } multiple fields { "rule" { "relation" "and", "children" \[ { "field" "balance increase", "value" 12, "operator" ">=" }, { "field" "balance amount", "value" 12, "operator" ">=" } ] } } operators the application supports the relational operators !=, >=,