---
title: Update Device Realms
slug: kronpam-api-collection-350/update-device-realms
docTags: 
createdAt: 2024-07-22T09:58:47.220Z
---

{
  "id": "MoKVgFwG1eaKtXQIPQ3xl",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/discovery/updateDeviceRealms",
    "name": "",
    "description": "<p>This method updates a current device realm to KRON PAM.</p>\n<p>Mandatory fields:</p>\n<p>\"dbId\":</p>\n<p>\"name\":</p>\n<p>\"deviceGroups\": [\n{</p>\n<pre><code>\"dbId\":,\n\n\"id\":}]\n</code></pre>\n<p>\"userGroups\": [\n{\"id\": \"\"}</p>\n<p>Other fields can be removed.</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\t   \"dbId\":139033,       \n       \"name\": \"TEST_DeviceRealm\",\n       \"description\": \"TEST_DeviceRealm\",\n       \"deviceGroups\": [\n            {\n                \"dbId\": 83057,\n        \"id\": \"787b7f7c-2d28-4009-892b-e059b3510b15\"\n            },\n            {\n            \t  \"dbId\": 118207,\n        \"id\": \"478e7007-4f52-4c6d-a9bf-14252848ccfc\"\n            }\n        ],\n        \"userGroups\": [\n            {\"id\": \"57888613-58bd-4008-af8a-729dc53edbed\",\n                \"eid\": \"SshUG1\"}\n        ]\n    }\n]\n",
          "value": "[   {\n\t   \"dbId\":139033,       \n       \"name\": \"TEST_DeviceRealm\",\n       \"description\": \"TEST_DeviceRealm\",\n       \"deviceGroups\": [\n            {\n                \"dbId\": 83057,\n        \"id\": \"787b7f7c-2d28-4009-892b-e059b3510b15\"\n            },\n            {\n            \t  \"dbId\": 118207,\n        \"id\": \"478e7007-4f52-4c6d-a9bf-14252848ccfc\"\n            }\n        ],\n        \"userGroups\": [\n            {\"id\": \"57888613-58bd-4008-af8a-729dc53edbed\",\n                \"eid\": \"SshUG1\"}\n        ]\n    }\n]\n",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "updateDeviceRealms",
        "jsonExample": "{\n    \"TEST_DeviceRealm\": \"Success\"\n}"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "1qbzVoBAUnah4Gfh4_c5i",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/updateDeviceRealms \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-xsrf-token: {{csrftoken}}' \\\n     --data '\"[   {\\n\\t   \\\"dbId\\\":139033,       \\n       \\\"name\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"description\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"deviceGroups\\\": [\\n            {\\n                \\\"dbId\\\": 83057,\\n        \\\"id\\\": \\\"787b7f7c-2d28-4009-892b-e059b3510b15\\\"\\n            },\\n            {\\n            \\t  \\\"dbId\\\": 118207,\\n        \\\"id\\\": \\\"478e7007-4f52-4c6d-a9bf-14252848ccfc\\\"\\n            }\\n        ],\\n        \\\"userGroups\\\": [\\n            {\\\"id\\\": \\\"57888613-58bd-4008-af8a-729dc53edbed\\\",\\n                \\\"eid\\\": \\\"SshUG1\\\"}\\n        ]\\n    }\\n]\\n\"'"
        },
        {
          "id": "9D8wsFK4kybfFmIcMpq2z",
          "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\\t   \\\"dbId\\\":139033,       \\n       \\\"name\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"description\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"deviceGroups\\\": [\\n            {\\n                \\\"dbId\\\": 83057,\\n        \\\"id\\\": \\\"787b7f7c-2d28-4009-892b-e059b3510b15\\\"\\n            },\\n            {\\n            \\t  \\\"dbId\\\": 118207,\\n        \\\"id\\\": \\\"478e7007-4f52-4c6d-a9bf-14252848ccfc\\\"\\n            }\\n        ],\\n        \\\"userGroups\\\": [\\n            {\\\"id\\\": \\\"57888613-58bd-4008-af8a-729dc53edbed\\\",\\n                \\\"eid\\\": \\\"SshUG1\\\"}\\n        ]\\n    }\\n]\\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/updateDeviceRealms\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "k5jCiY2sqioMXZK2kp--X",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/updateDeviceRealms\")\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\\t   \\\"dbId\\\":139033,       \\n       \\\"name\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"description\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"deviceGroups\\\": [\\n            {\\n                \\\"dbId\\\": 83057,\\n        \\\"id\\\": \\\"787b7f7c-2d28-4009-892b-e059b3510b15\\\"\\n            },\\n            {\\n            \\t  \\\"dbId\\\": 118207,\\n        \\\"id\\\": \\\"478e7007-4f52-4c6d-a9bf-14252848ccfc\\\"\\n            }\\n        ],\\n        \\\"userGroups\\\": [\\n            {\\\"id\\\": \\\"57888613-58bd-4008-af8a-729dc53edbed\\\",\\n                \\\"eid\\\": \\\"SshUG1\\\"}\\n        ]\\n    }\\n]\\n\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ISGEOzop_r35m8-c5O0vH",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/updateDeviceRealms\"\n\npayload = json.dumps(\"[   {\\n\\t   \\\"dbId\\\":139033,       \\n       \\\"name\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"description\\\": \\\"TEST_DeviceRealm\\\",\\n       \\\"deviceGroups\\\": [\\n            {\\n                \\\"dbId\\\": 83057,\\n        \\\"id\\\": \\\"787b7f7c-2d28-4009-892b-e059b3510b15\\\"\\n            },\\n            {\\n            \\t  \\\"dbId\\\": 118207,\\n        \\\"id\\\": \\\"478e7007-4f52-4c6d-a9bf-14252848ccfc\\\"\\n            }\\n        ],\\n        \\\"userGroups\\\": [\\n            {\\\"id\\\": \\\"57888613-58bd-4008-af8a-729dc53edbed\\\",\\n                \\\"eid\\\": \\\"SshUG1\\\"}\\n        ]\\n    }\\n]\\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": "1qbzVoBAUnah4Gfh4_c5i"
    },
    "results": {
      "languages": [
        {
          "id": "B7EolTqofCDojYOToGEfi",
          "language": "200",
          "code": "{\n    \"TEST_DeviceRealm\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "B7EolTqofCDojYOToGEfi"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}