API REFERENCE
Monitors base info
Create a new monitor
5 min
{ "name" "create a new monitor", "method" "post", "url" "https //api sandbox klavi ai/monitor/v1/monitors", "description" "create a new monitor base information", "tab" "examples", "examples" { "languages" \[ { "id" "roenc6muxt3o5qbwb0sid", "language" "curl", "code" "curl location 'https //api sandbox klavi ai/monitor/v1/monitors' \\\\\n header 'authorization string' \\\\\n data '{\\"name\\" \\"string\\",\\"onlinestatus\\" \\"number\\",\\"monitorweekday\\" \\"array\\",\\"monitortimes\\" \\"number\\",\\"notificationemails\\" \\"array\\",\\"rules\\" \\"object\\",\\"resultdeliveries\\" \\"object\\"}'", "customlabel" "" }, { "id" "ylhutomcbymaxbvtlxd8y", "language" "nodejs", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //api sandbox klavi ai/monitor/v1/monitors',\n 'headers' {\n 'authorization' 'string'\n },\n body '{\\"name\\" \\"string\\",\\"onlinestatus\\" \\"number\\",\\"monitorweekday\\" \\"array\\",\\"monitortimes\\" \\"number\\",\\"notificationemails\\" \\"array\\",\\"rules\\" \\"object\\",\\"resultdeliveries\\" \\"object\\"}'\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "customlabel" "" }, { "id" "m1jqqp5gr cqf duzvzy4", "language" "javascript", "code" "var myheaders = new headers();\nmyheaders append(\\"authorization\\", \\"string\\");\n\nvar raw = \\"{\\\\\\"name\\\\\\" \\\\\\"string\\\\\\",\\\\\\"onlinestatus\\\\\\" \\\\\\"number\\\\\\",\\\\\\"monitorweekday\\\\\\" \\\\\\"array\\\\\\",\\\\\\"monitortimes\\\\\\" \\\\\\"number\\\\\\",\\\\\\"notificationemails\\\\\\" \\\\\\"array\\\\\\",\\\\\\"rules\\\\\\" \\\\\\"object\\\\\\",\\\\\\"resultdeliveries\\\\\\" \\\\\\"object\\\\\\"}\\";\n\nvar requestoptions = {\n method 'post',\n headers myheaders,\n body raw,\n redirect 'follow'\n};\n\nfetch(\\"https //api sandbox klavi ai/monitor/v1/monitors\\", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));", "customlabel" "" }, { "id" "f7q7i1rqngjhqpgyaekfg", "language" "python", "code" "import requests\n\nurl = \\"https //api sandbox klavi ai/monitor/v1/monitors\\"\n\npayload = \\"{\\\\\\"name\\\\\\" \\\\\\"string\\\\\\",\\\\\\"onlinestatus\\\\\\" \\\\\\"number\\\\\\",\\\\\\"monitorweekday\\\\\\" \\\\\\"array\\\\\\",\\\\\\"monitortimes\\\\\\" \\\\\\"number\\\\\\",\\\\\\"notificationemails\\\\\\" \\\\\\"array\\\\\\",\\\\\\"rules\\\\\\" \\\\\\"object\\\\\\",\\\\\\"resultdeliveries\\\\\\" \\\\\\"object\\\\\\"}\\"\nheaders = {\n 'authorization' 'string'\n}\n\nresponse = requests request(\\"post\\", url, headers=headers, data=payload)\n\nprint(response text)\n", "customlabel" "" }, { "id" "adacjlpbzd0afdjs0utvf", "language" "ruby", "code" "require \\"uri\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //api sandbox klavi ai/monitor/v1/monitors\\")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http post new(url)\nrequest\[\\"authorization\\"] = \\"string\\"\nrequest body = \\"{\\\\\\"name\\\\\\" \\\\\\"string\\\\\\",\\\\\\"onlinestatus\\\\\\" \\\\\\"number\\\\\\",\\\\\\"monitorweekday\\\\\\" \\\\\\"array\\\\\\",\\\\\\"monitortimes\\\\\\" \\\\\\"number\\\\\\",\\\\\\"notificationemails\\\\\\" \\\\\\"array\\\\\\",\\\\\\"rules\\\\\\" \\\\\\"object\\\\\\",\\\\\\"resultdeliveries\\\\\\" \\\\\\"object\\\\\\"}\\"\n\nresponse = https request(request)\nputs response read body\n", "customlabel" "" } ], "selectedlanguageid" "roenc6muxt3o5qbwb0sid" }, "results" { "languages" \[ { "id" "ncvn27lv9tlsqza48dpfa", "language" "200", "customlabel" "", "code" "{\n \\"id\\" \\"64a8c71f 71db 4972 82b1 1aadc5434dd8\\"\n}" } ], "selectedlanguageid" "ncvn27lv9tlsqza48dpfa" }, "request" { "pathparameters" \[], "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" "name", "kind" "required", "type" "string", "description" "name of the monitor", "" "name of the monitor" }, { "name" "onlinestatus", "kind" "required", "type" "boolean", "description" "monitor status true/false", "" "monitor status true/false" }, { "name" "monitorweekdays", "kind" "required", "type" "array", "description" "monitoring dates within a week \[\\"mon\\",\\"tue\\",\\"wed\\",\\"thu\\",\\"fri\\",\\"sat\\",\\"sun\\"]", "" "monitoring dates within a week \[\\"mon\\",\\"tue\\",\\"wed\\",\\"thu\\",\\"fri\\",\\"sat\\",\\"sun\\"]" }, { "name" "monitorfrequency", "kind" "required", "type" "number", "description" "daily monitoring frequency \[1, 2]\n", "" "daily monitoring frequency \[1, 2]\n" }, { "name" "notificationemails", "kind" "optional", "type" "array", "description" "mailing list for sending notifications, the mail must be created in advance in the klavi console", "" "mailing list for sending notifications, the mail must be created in advance in the klavi console" }, { "name" "rule", "kind" "required", "type" "object", "description" "monitor rule", "" "monitor rule", "children" \[ { "name" "relation", "kind" "optional", "type" "string", "description" "the elements in the list currently only support and" }, { "name" "children", "kind" "optional", "type" "array", "description" "field list" } ], "schema" \[ { "name" "relation", "kind" "optional", "type" "string", "description" "the elements in the list currently only support and" }, { "name" "children", "kind" "optional", "type" "array", "description" "field list" } ] }, { "name" "resultdeliveries", "kind" "optional", "type" "object", "description" "configure the method for receiving data ", "" "configure the method for receiving data ", "children" \[ { "name" "event", "kind" "optional", "type" "object", "description" "requires partner to provide webhook for event reception ", "children" \[ { "name" "webhook", "kind" "required", "type" "string", "description" "http address " }, { "name" "headers", "kind" "optional", "type" "array", "description" "http request header " } ] }, { "name" "sftp", "kind" "optional", "type" "string", "description" "require partner to provide the ftp address for receiving data, format sftp\ //username\ password\@hostname\ port", "children" \[ { "name" "hostname", "kind" "required", "type" "string", "description" "" }, { "name" "port", "kind" "required", "type" "number", "description" "" }, { "name" "username", "kind" "required", "type" "string", "description" "" }, { "name" "password", "kind" "required", "type" "string", "description" "" } ] } ], "schema" \[ { "name" "event", "kind" "optional", "type" "object", "description" "requires partner to provide webhook for event reception ", "children" \[ { "name" "webhook", "kind" "required", "type" "string", "description" "http address " }, { "name" "headers", "kind" "optional", "type" "array", "description" "http request header " } ] }, { "name" "sftp", "kind" "optional", "type" "string", "description" "require partner to provide the ftp address for receiving data, format sftp\ //username\ password\@hostname\ port", "children" \[ { "name" "hostname", "kind" "required", "type" "string", "description" "" }, { "name" "port", "kind" "required", "type" "number", "description" "" }, { "name" "username", "kind" "required", "type" "string", "description" "" }, { "name" "password", "kind" "required", "type" "string", "description" "" } ] } ] } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "header parameter", "value" "headerparameters" }, "hastryitout" false, "response" \[ { "name" "id", "kind" "optional", "type" "string", "description" "id of the monitor" }, { "name" "presignedurl", "kind" "optional", "type" "string", "description" "used for uploading user list files", "children" \[] } ] } 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 { "onlinestatus" false, "name" "monitor test", "monitorfrequency" 1, "monitorweekdays" \[ "mon", "tue", "wed", "thu", "fri", "sat", "sun" ], "rule" { "relation" "and", "children" \[ { "field" "balance increase", "value" 12 23, "operator" ">=" }, { "field" "balance amount", "value" 10, "operator" ">=" } ] }, "resultdeliveries" { "event" { "webhook" "https //client webhook com", "headers" \[ { "key" "key", "value" "value" } ] } } }