Save Policy Group
1 min
code examples curl request post \\ \ url {{url}}/aioc rest web/rest/policy/savepolicykeygroup \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ header 'x xsrf token {{csrftoken}}' \\ \ data '" {\r\n \\"dbid\\" 19934,\r\n \\"name\\" \\"pg ex\\",\r\n \\"description\\" \\"p api\\",\r\n \\"httppolicies\\" \[],\r\n \\"maskingpolicies\\" \[],\r\n \\"timerestrictions\\" \[],\r\n \\"sendemail\\" false,\r\n \\"sendsnmp\\" false,\r\n \\"action\\" \\"generate error\\",\r\n \\"confirmationtext\\" null,\r\n \\"operationmode\\" \\"operation\\",\r\n \\"usercreate\\" null\r\n }"'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); myheaders append("x xsrf token", "{{csrftoken}}"); var raw = json stringify(" {\r\n \\"dbid\\" 19934,\r\n \\"name\\" \\"pg ex\\",\r\n \\"description\\" \\"p api\\",\r\n \\"httppolicies\\" \[],\r\n \\"maskingpolicies\\" \[],\r\n \\"timerestrictions\\" \[],\r\n \\"sendemail\\" false,\r\n \\"sendsnmp\\" false,\r\n \\"action\\" \\"generate error\\",\r\n \\"confirmationtext\\" null,\r\n \\"operationmode\\" \\"operation\\",\r\n \\"usercreate\\" null\r\n }"); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("{{url}}/aioc rest web/rest/policy/savepolicykeygroup", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("{{url}}/aioc rest web/rest/policy/savepolicykeygroup") http = net http new(url host, url port); request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request\["x xsrf token"] = "{{csrftoken}}" request body = json dump(" {\r\n \\"dbid\\" 19934,\r\n \\"name\\" \\"pg ex\\",\r\n \\"description\\" \\"p api\\",\r\n \\"httppolicies\\" \[],\r\n \\"maskingpolicies\\" \[],\r\n \\"timerestrictions\\" \[],\r\n \\"sendemail\\" false,\r\n \\"sendsnmp\\" false,\r\n \\"action\\" \\"generate error\\",\r\n \\"confirmationtext\\" null,\r\n \\"operationmode\\" \\"operation\\",\r\n \\"usercreate\\" null\r\n }") response = http request(request) puts response read body import requests import json url = "{{url}}/aioc rest web/rest/policy/savepolicykeygroup" payload = json dumps(" {\r\n \\"dbid\\" 19934,\r\n \\"name\\" \\"pg ex\\",\r\n \\"description\\" \\"p api\\",\r\n \\"httppolicies\\" \[],\r\n \\"maskingpolicies\\" \[],\r\n \\"timerestrictions\\" \[],\r\n \\"sendemail\\" false,\r\n \\"sendsnmp\\" false,\r\n \\"action\\" \\"generate error\\",\r\n \\"confirmationtext\\" null,\r\n \\"operationmode\\" \\"operation\\",\r\n \\"usercreate\\" null\r\n }") headers = { 'accept' 'application/json', 'content type' 'application/json', 'x xsrf token' '{{csrftoken}}' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses { "dbid" 406596, "name" "pg ex", "description" "p api", "policies" \[], "policykeys" \[], "httppolicies" \[], "maskingpolicies" \[], "timerestrictions" \[], "realms" null, "sendemail" false, "sendsnmp" false, "action" "generate error", "confirmationtext" null, "operationmode" "operation", "usercreate" null, "userupdate" null, "creationdate" null, "lastupdate" null }