---
title: Update Device Realms
slug: single-connect-api-3-2-0/update-device-realms
description: Learn how to update device realms using the `curl` command by following this code example. This document includes a step-by-step guide on making a POST request with JSON data and provides all the necessary headers, URL, and data you need.
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "jNu-awbR2Pa2HlSUB5uOh",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/updateDeviceRealms",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "[   {\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",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "updateDeviceRealms",
        "jsonExample": "{\n    \"TEST_DeviceRealm\": \"Success\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method updates a current device realm to Single Connect.</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>",
    "examples": {
      "languages": [
        {
          "id": "IpjEaULVavjqD-CjHjQmV",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/updateDeviceRealms \\\n     --header 'accept: application/json'"
        },
        {
          "id": "3bhhLgtCXLx0ZoseV100L",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\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": "xcyiWJW_uWdDLqiwi0TmR",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\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\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "iZKxzNrzEjcoUCpJ4xDDX",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/updateDeviceRealms\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "IpjEaULVavjqD-CjHjQmV"
    },
    "results": {
      "languages": [
        {
          "id": "6LQAWZFi1FB9LoqAC45xa",
          "language": "200",
          "code": "{\n    \"TEST_DeviceRealm\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "6LQAWZFi1FB9LoqAC45xa"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}