---
title: Update Device Groups
slug: single-connect-api-3-2-0/update-device-groups
description: Learn how to make a POST request to update device groups in a REST API endpoint using the curl command. This handy code example includes the necessary headers and data, making it easier for you to incorporate in your own projects.
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "U7xCdOfIoST2ye9aWaWDZ",
  "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": "Qeb5Lcg3nb8USFOOyIyF_",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/updateDeviceGroups \\\n     --header 'accept: application/json'"
        },
        {
          "id": "Xr9zDBw5tAdrExzUEVxWJ",
          "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": "w8tSyKLFdna4iO9muum9F",
          "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": "iKjP3OeOvTVNntgbnVZIe",
          "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": "Qeb5Lcg3nb8USFOOyIyF_"
    },
    "results": {
      "languages": [
        {
          "id": "Sj7ZUftDMdlCnmX2mJ1q0",
          "language": "200",
          "code": "{\n    \"DG_Test\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "Sj7ZUftDMdlCnmX2mJ1q0"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}