---
title: Update Device Groups
slug: single-connect-api-3-0-3/update-device-groups
description: Learn how to update device groups in a REST API using the powerful curl command. This document offers a comprehensive code example, complete with essential headers and data payload, to ensure seamless integration and efficient management of your device gr
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "UhcWkwOpaBCSCXCDCgToo",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/updateDeviceGroups",
    "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        \"dbId\": 3479436,\n        \"id\": \"b7577164-c147-4609-b784-ffae4f4379a8\",\n        \"name\": \"DG_Test\",\n        \"description\": \"DG_Test\",\n        \"parentGroupId\": null,\n        \"ifaceOperationCheck\": false,\n        \"timeTolerance\": null,\n        \"realms\": [\n            3478516\n        ],\n        \"deviceIds\": [\n            173076\n        ],\n        \"properties\": {\n            \"globalPassword\": \"T6zncxX0hfwMZg9LuzKY4w==\",\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    }]",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "updateDeviceGroups",
        "jsonExample": "{\n    \"DG_Test\": \"Success\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method updates device groups information in Single Connect.</p>\n<p>Copy devices info from getDeviceGroup methods.</p>\n<p>Then, change device group info to be updated in this method.</p>",
    "examples": {
      "languages": [
        {
          "id": "gF-zMLqdmYWSJDjBug0M8",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/updateDeviceGroups \\\n     --header 'accept: application/json'"
        },
        {
          "id": "EdyO4uOFf7YJY2TW7QCxP",
          "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/updateDeviceGroups\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "G6Dfw5ONeRx8m1Wt7qrq3",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/updateDeviceGroups\")\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": "-NOEb3REWJhmItnPVQDrk",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/updateDeviceGroups\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "gF-zMLqdmYWSJDjBug0M8"
    },
    "results": {
      "languages": [
        {
          "id": "lNVn28-Vi8iKBJ3gl-XzD",
          "language": "200",
          "code": "{\n    \"DG_Test\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "lNVn28-Vi8iKBJ3gl-XzD"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}