---
title: List Device Group By Name
slug: single-connect-api-3-0-3/list-device-group-by-name
description: Learn how to make a GET request using curl with this code example. Find out how to specify a URL and include headers to accept and send JSON data. Use this request to efficiently retrieve a device group by its name.
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "cQ2PZSm9S6rm054Va1qDe",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/getDeviceGroupByName/DEVICEGROUPNAME",
    "method": "GET",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "getDeviceGroupByName",
        "jsonExample": "{\n    \"dbId\": 107395,\n    \"id\": \"8851fead-2b5e-4769-b847-fc8a898999a0\",\n    \"name\": \"SSH\",\n    \"description\": null,\n    \"parentGroupId\": null,\n    \"ifaceOperationCheck\": false,\n    \"timeTolerance\": null,\n    \"realms\": [\n        107888\n    ],\n    \"deviceIds\": [\n        137963\n    ],\n    \"properties\": {\n        \"globalUsername\": \"root\",\n        \"globalPassword\": \"8k646jpc0XKY+gdetfj3jw==\"\n    },\n    \"children\": null,\n    \"devices\": null,\n    \"rootGroupId\": null,\n    \"globalUsername\": \"root\",\n    \"globalPassword\": \"8k646jpc0XKY+gdetfj3jw==\",\n    \"showInDeviceTree\": true,\n    \"useAsRoleGroup\": true,\n    \"discoverySources\": null,\n    \"readOnly\": false\n}"
      }
    ],
    "contentType": "application/json",
    "description": "This method gets the device group information in detail.\n\nEnter the name of chosen device group to \"DEVICEGROUPNAME\" field in get url.",
    "examples": {
      "languages": [
        {
          "id": "1bP-sUQzI-_u5Uif_SMpP",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url {{url}}/aioc-rest-web/rest/discovery/getDeviceGroupByName/DEVICEGROUPNAME \\\n     --header 'accept: application/json'"
        },
        {
          "id": "oKz-9TzfGbIqEZfpyRYQr",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/discovery/getDeviceGroupByName/DEVICEGROUPNAME\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "HTAIYR8bcbukF-_LdrtYE",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/getDeviceGroupByName/DEVICEGROUPNAME\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "rjhb__3rlXFbJYrat-m-B",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/getDeviceGroupByName/DEVICEGROUPNAME\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "1bP-sUQzI-_u5Uif_SMpP"
    },
    "results": {
      "languages": [
        {
          "id": "1UwYr5qbfAsdxoHh3Cifw",
          "language": "200",
          "code": "{\n    \"dbId\": 107395,\n    \"id\": \"8851fead-2b5e-4769-b847-fc8a898999a0\",\n    \"name\": \"SSH\",\n    \"description\": null,\n    \"parentGroupId\": null,\n    \"ifaceOperationCheck\": false,\n    \"timeTolerance\": null,\n    \"realms\": [\n        107888\n    ],\n    \"deviceIds\": [\n        137963\n    ],\n    \"properties\": {\n        \"globalUsername\": \"root\",\n        \"globalPassword\": \"8k646jpc0XKY+gdetfj3jw==\"\n    },\n    \"children\": null,\n    \"devices\": null,\n    \"rootGroupId\": null,\n    \"globalUsername\": \"root\",\n    \"globalPassword\": \"8k646jpc0XKY+gdetfj3jw==\",\n    \"showInDeviceTree\": true,\n    \"useAsRoleGroup\": true,\n    \"discoverySources\": null,\n    \"readOnly\": false\n}"
        }
      ],
      "selectedLanguageId": "1UwYr5qbfAsdxoHh3Cifw"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}