---
title: List Device Group Subnets
slug: single-connect-api-3-2-0/list-device-group-subnets
description: Learn how to use curl to send a GET request and fetch JSON data from a designated URL. Explore this code example, which also covers headers essential for accepting and transmitting JSON information. Ideal for developers seeking practical guidance on worki
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "2nI9IJDSE1VkV4xOQL3HA",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/getDeviceGroupSubnets/ID",
    "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": "getDeviceGroupSubnets",
        "jsonExample": "[\n    {\n        \"dbId\": 3481062,\n        \"deviceGroupId\": \"7dad2aa5-414a-4b20-86c0-346876ea88b5\",\n        \"subnetIp\": \"10.20.40.1\",\n        \"mask\": null,\n        \"cidr\": 24,\n        \"firstIp\": 169093121,\n        \"lastIp\": 169093376,\n        \"interfaceName\": null\n    }\n]"
      }
    ],
    "contentType": "application/json",
    "description": "This method lists subnet of the device group.\n\nEnter the Device group id of chosen device group to \"ID\" field in get url.",
    "examples": {
      "languages": [
        {
          "id": "XBR4LqsrCG0Ol-EauIz29",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url {{url}}/aioc-rest-web/rest/discovery/getDeviceGroupSubnets/ID \\\n     --header 'accept: application/json'"
        },
        {
          "id": "yKt6PueRMDEh9m3qQSi2Y",
          "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/getDeviceGroupSubnets/ID\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "k2dncAql_WPNBMiN7Bf7B",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/getDeviceGroupSubnets/ID\")\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": "ETQisJXWuy1oioy7aXvwb",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/getDeviceGroupSubnets/ID\"\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": "XBR4LqsrCG0Ol-EauIz29"
    },
    "results": {
      "languages": [
        {
          "id": "cPrW2ckNfZjxLzXkXC10n",
          "language": "200",
          "code": "[\n    {\n        \"dbId\": 3481062,\n        \"deviceGroupId\": \"7dad2aa5-414a-4b20-86c0-346876ea88b5\",\n        \"subnetIp\": \"10.20.40.1\",\n        \"mask\": null,\n        \"cidr\": 24,\n        \"firstIp\": 169093121,\n        \"lastIp\": 169093376,\n        \"interfaceName\": null\n    }\n]"
        }
      ],
      "selectedLanguageId": "cPrW2ckNfZjxLzXkXC10n"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}