Create Vault Groups (Bulk Create)
1 min
POST
{{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups
Path Parameters
- urlstringDefaulturl
Header Parameters
- X-XSRF-TOKENstringDefault{{csrftoken}}
Body Parameters
- bodyobjectDefault[ { "name":"Group2", "description":"Desc2 of Group2", "parentSapmGroupId":13682 }, { "name":"Groupx", "description":"Descx" }, { "name":"Groupx", "description":"Descx" } ]
Responses
200
curl
curl --request POST \
--url {{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-xsrf-token: {{csrftoken}}' \
--data '"[\n\t{\n\t\"name\":\"Group2\",\n\t\"description\":\"Desc2 of Group2\",\n\t\"parentSapmGroupId\":13682\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t}\n]\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("[\n\t{\n\t\"name\":\"Group2\",\n\t\"description\":\"Desc2 of Group2\",\n\t\"parentSapmGroupId\":13682\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t}\n]\n");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("{{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups", 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/sc/sapm/createSapmGroups")
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("[\n\t{\n\t\"name\":\"Group2\",\n\t\"description\":\"Desc2 of Group2\",\n\t\"parentSapmGroupId\":13682\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t}\n]\n")
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "{{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups"
payload = json.dumps("[\n\t{\n\t\"name\":\"Group2\",\n\t\"description\":\"Desc2 of Group2\",\n\t\"parentSapmGroupId\":13682\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t}\n]\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)
200
[
{
"modelData": {
"name": "Group2",
"description": "Desc2 of Group2",
"parentSapmGroupId": 982668
},
"message": "SUCCESS"
},
{
"modelData": {
"name": "Groupx",
"description": "Descx",
"parentSapmGroupId": null
},
"message": "SUCCESS"
},
{
"modelData": {
"name": "Groupx",
"description": "Descx",
"parentSapmGroupId": null
},
"message": "A Sapm group named Groupx already exists"
}
]