Update Element Type
1 min
POST
{{url}}/aioc-rest-web/rest/elementType/saveElementType
Path Parameters
- urlstringDefaulturl
Header Parameters
- Content-TypestringDefaultapplication/json
- X-XSRF-TOKENstringDefault{{csrftoken}}
Body Parameters
- bodyobjectDefault{ "dbId": "8643", "elementTypeId": "acme", "elementTypeName": "ACME", "vendor": { "dbId": 57, "name": "Acme" }, "category": { "dbId": 54, "name": "Other" }, "elementTypeProperties": [{ "dbId": 20474, "elementTypePropertyValue": ".*(?i)user(name)?.*", "elementTypePropertyKey": "enforcer.terminal.behaviour.exc_last_line_patterns", "elementTypePropertyType": { "displayName": "enforcer.terminal.behaviour.exc_last_line_patterns", "allowMultipleValues": true, "valuesPredefined": false, "elementTypePropertyValues": null, "elementTypePropertyKey": "enforcer.terminal.behaviour.exc_last_line_patterns", "valueType": "REGEX", "encryption": false } }, { "dbId": 130, "elementTypePropertyValue": ".*(?i)password.*[:|>].*", "elementTypePropertyKey": "enforcer.terminal.behaviour.exc_last_line_patterns", "elementTypePropertyType": { "displayName": "enforcer.terminal.behaviour.exc_last_line_patterns", "allowMultipleValues": true, "valuesPredefined": false, "elementTypePropertyValues": null, "elementTypePropertyKey": "enforcer.terminal.behaviour.exc_last_line_patterns", "valueType": "REGEX", "encryption": false } }] }
Responses
500
curl
curl --request POST \
--url {{url}}/aioc-rest-web/rest/elementType/saveElementType \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-xsrf-token: {{csrftoken}}' \
--data '"{ \r\n \"dbId\": \"8643\", \r\n \"elementTypeId\": \"acme\", \r\n \"elementTypeName\": \"ACME\", \r\n \"vendor\": {\r\n \"dbId\": 57,\r\n \"name\": \"Acme\"\r\n },\r\n \"category\": {\r\n \"dbId\": 54,\r\n \"name\": \"Other\"\r\n },\r\n \"elementTypeProperties\": [{\r\n \"dbId\": 20474,\r\n \"elementTypePropertyValue\": \".*(?i)user(name)?.*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n },\r\n {\r\n \"dbId\": 130,\r\n \"elementTypePropertyValue\": \".*(?i)password.*[:|>].*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n }]\r\n }\r\n"'javascript
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\": \"8643\", \r\n \"elementTypeId\": \"acme\", \r\n \"elementTypeName\": \"ACME\", \r\n \"vendor\": {\r\n \"dbId\": 57,\r\n \"name\": \"Acme\"\r\n },\r\n \"category\": {\r\n \"dbId\": 54,\r\n \"name\": \"Other\"\r\n },\r\n \"elementTypeProperties\": [{\r\n \"dbId\": 20474,\r\n \"elementTypePropertyValue\": \".*(?i)user(name)?.*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n },\r\n {\r\n \"dbId\": 130,\r\n \"elementTypePropertyValue\": \".*(?i)password.*[:|>].*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n }]\r\n }\r\n");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("{{url}}/aioc-rest-web/rest/elementType/saveElementType", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("{{url}}/aioc-rest-web/rest/elementType/saveElementType")
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\": \"8643\", \r\n \"elementTypeId\": \"acme\", \r\n \"elementTypeName\": \"ACME\", \r\n \"vendor\": {\r\n \"dbId\": 57,\r\n \"name\": \"Acme\"\r\n },\r\n \"category\": {\r\n \"dbId\": 54,\r\n \"name\": \"Other\"\r\n },\r\n \"elementTypeProperties\": [{\r\n \"dbId\": 20474,\r\n \"elementTypePropertyValue\": \".*(?i)user(name)?.*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n },\r\n {\r\n \"dbId\": 130,\r\n \"elementTypePropertyValue\": \".*(?i)password.*[:|>].*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n }]\r\n }\r\n")
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "{{url}}/aioc-rest-web/rest/elementType/saveElementType"
payload = json.dumps("{ \r\n \"dbId\": \"8643\", \r\n \"elementTypeId\": \"acme\", \r\n \"elementTypeName\": \"ACME\", \r\n \"vendor\": {\r\n \"dbId\": 57,\r\n \"name\": \"Acme\"\r\n },\r\n \"category\": {\r\n \"dbId\": 54,\r\n \"name\": \"Other\"\r\n },\r\n \"elementTypeProperties\": [{\r\n \"dbId\": 20474,\r\n \"elementTypePropertyValue\": \".*(?i)user(name)?.*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n },\r\n {\r\n \"dbId\": 130,\r\n \"elementTypePropertyValue\": \".*(?i)password.*[:|>].*\",\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"elementTypePropertyType\": {\r\n \"displayName\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"allowMultipleValues\": true,\r\n \"valuesPredefined\": false,\r\n \"elementTypePropertyValues\": null,\r\n \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\r\n \"valueType\": \"REGEX\",\r\n \"encryption\": false\r\n }\r\n }]\r\n }\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)
500
Element Type Id already exists.