---
title: Save New Device Groups
slug: kronpam-api-collection-350/save-new-device-groups
docTags: 
createdAt: 2024-07-22T09:58:47.220Z
---

{
  "id": "RhOf8rNErneGAB7NR64Va",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroups",
    "name": "",
    "description": "<p>This method adds a new device group in KRON PAM.</p>\n<p>Mandatory fields:\r\n\"name\"</p>\n<p>Many devices can be saved in one request as bulk import by adding the related info in the request body.</p>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "Content-Type",
          "description": "",
          "default": "application/json",
          "value": "application/json",
          "type": "string"
        },
        {
          "name": "X-XSRF-TOKEN",
          "description": "",
          "default": "{{csrftoken}}",
          "value": "{{csrftoken}}",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "description": "",
          "default": "[{\n\n        \"name\": \"TESTDG_Test\",\n        \"description\": \"TESTDG_Test\",\n        \"parentGroupId\": null,\n        \"ifaceOperationCheck\": false,\n        \"timeTolerance\": null,\n        \"realms\": [\n            3478516\n        ],\n        \"deviceIds\": [\n            173076\n        ],\n        \"properties\": {\n            \"globalPassword\": \"123123\",\n            \"globalUsername\": \"admin\"\n        },\n        \"children\": null,\n        \"devices\": null,\n        \"showInDeviceTree\": true,\n        \"useAsRoleGroup\": true,\n        \"rootGroupId\": null,\n        \"discoverySources\": null,\n        \"readOnly\": false\n    }]",
          "value": "[{\n\n        \"name\": \"TESTDG_Test\",\n        \"description\": \"TESTDG_Test\",\n        \"parentGroupId\": null,\n        \"ifaceOperationCheck\": false,\n        \"timeTolerance\": null,\n        \"realms\": [\n            3478516\n        ],\n        \"deviceIds\": [\n            173076\n        ],\n        \"properties\": {\n            \"globalPassword\": \"123123\",\n            \"globalUsername\": \"admin\"\n        },\n        \"children\": null,\n        \"devices\": null,\n        \"showInDeviceTree\": true,\n        \"useAsRoleGroup\": true,\n        \"rootGroupId\": null,\n        \"discoverySources\": null,\n        \"readOnly\": false\n    }]",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "saveDeviceGroups",
        "jsonExample": "{\n    \"TESTDG_Test\": \"Success\"\n}"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "kO5AqIe8X5GUvzBPWVzAQ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/saveDeviceGroups \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-xsrf-token: {{csrftoken}}' \\\n     --data '\"[{\\n\\n        \\\"name\\\": \\\"TESTDG_Test\\\",\\n        \\\"description\\\": \\\"TESTDG_Test\\\",\\n        \\\"parentGroupId\\\": null,\\n        \\\"ifaceOperationCheck\\\": false,\\n        \\\"timeTolerance\\\": null,\\n        \\\"realms\\\": [\\n            3478516\\n        ],\\n        \\\"deviceIds\\\": [\\n            173076\\n        ],\\n        \\\"properties\\\": {\\n            \\\"globalPassword\\\": \\\"123123\\\",\\n            \\\"globalUsername\\\": \\\"admin\\\"\\n        },\\n        \\\"children\\\": null,\\n        \\\"devices\\\": null,\\n        \\\"showInDeviceTree\\\": true,\\n        \\\"useAsRoleGroup\\\": true,\\n        \\\"rootGroupId\\\": null,\\n        \\\"discoverySources\\\": null,\\n        \\\"readOnly\\\": false\\n    }]\"'"
        },
        {
          "id": "HmM6MjN6x3_gWRUZwnktM",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-xsrf-token\", \"{{csrftoken}}\");\n\nvar raw = JSON.stringify(\"[{\\n\\n        \\\"name\\\": \\\"TESTDG_Test\\\",\\n        \\\"description\\\": \\\"TESTDG_Test\\\",\\n        \\\"parentGroupId\\\": null,\\n        \\\"ifaceOperationCheck\\\": false,\\n        \\\"timeTolerance\\\": null,\\n        \\\"realms\\\": [\\n            3478516\\n        ],\\n        \\\"deviceIds\\\": [\\n            173076\\n        ],\\n        \\\"properties\\\": {\\n            \\\"globalPassword\\\": \\\"123123\\\",\\n            \\\"globalUsername\\\": \\\"admin\\\"\\n        },\\n        \\\"children\\\": null,\\n        \\\"devices\\\": null,\\n        \\\"showInDeviceTree\\\": true,\\n        \\\"useAsRoleGroup\\\": true,\\n        \\\"rootGroupId\\\": null,\\n        \\\"discoverySources\\\": null,\\n        \\\"readOnly\\\": false\\n    }]\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroups\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Db27csoVkDPlvJ4lt6u1L",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroups\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-xsrf-token\"] = \"{{csrftoken}}\"\nrequest.body = JSON.dump(\"[{\\n\\n        \\\"name\\\": \\\"TESTDG_Test\\\",\\n        \\\"description\\\": \\\"TESTDG_Test\\\",\\n        \\\"parentGroupId\\\": null,\\n        \\\"ifaceOperationCheck\\\": false,\\n        \\\"timeTolerance\\\": null,\\n        \\\"realms\\\": [\\n            3478516\\n        ],\\n        \\\"deviceIds\\\": [\\n            173076\\n        ],\\n        \\\"properties\\\": {\\n            \\\"globalPassword\\\": \\\"123123\\\",\\n            \\\"globalUsername\\\": \\\"admin\\\"\\n        },\\n        \\\"children\\\": null,\\n        \\\"devices\\\": null,\\n        \\\"showInDeviceTree\\\": true,\\n        \\\"useAsRoleGroup\\\": true,\\n        \\\"rootGroupId\\\": null,\\n        \\\"discoverySources\\\": null,\\n        \\\"readOnly\\\": false\\n    }]\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "pCQRbELniBtSnUwt3y2KI",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroups\"\n\npayload = json.dumps(\"[{\\n\\n        \\\"name\\\": \\\"TESTDG_Test\\\",\\n        \\\"description\\\": \\\"TESTDG_Test\\\",\\n        \\\"parentGroupId\\\": null,\\n        \\\"ifaceOperationCheck\\\": false,\\n        \\\"timeTolerance\\\": null,\\n        \\\"realms\\\": [\\n            3478516\\n        ],\\n        \\\"deviceIds\\\": [\\n            173076\\n        ],\\n        \\\"properties\\\": {\\n            \\\"globalPassword\\\": \\\"123123\\\",\\n            \\\"globalUsername\\\": \\\"admin\\\"\\n        },\\n        \\\"children\\\": null,\\n        \\\"devices\\\": null,\\n        \\\"showInDeviceTree\\\": true,\\n        \\\"useAsRoleGroup\\\": true,\\n        \\\"rootGroupId\\\": null,\\n        \\\"discoverySources\\\": null,\\n        \\\"readOnly\\\": false\\n    }]\")\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-xsrf-token': '{{csrftoken}}'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "kO5AqIe8X5GUvzBPWVzAQ"
    },
    "results": {
      "languages": [
        {
          "id": "iHPIeF1DgAeOKP4rKanYB",
          "language": "200",
          "code": "{\n    \"TESTDG_Test\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "iHPIeF1DgAeOKP4rKanYB"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}