---
title: Save New Device Group Subnet
slug: single-connect-api-3-2-0/save-new-device-group-subnet
description: Learn how to use the `curl` command to make a POST request and save a device group subnet. This document includes a code example that demonstrates how to correctly set the Accept and Content-Type headers, as well as specifying the request body as a string
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "oCuujTXFZe01tyWsycaCI",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupSubnet",
    "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\": 303880,\n     \"deviceGroupId\": \"7dad2aa5-414a-4b20-86c0-346876ea88b5\",\n        \n        \"subnetIp\": \"10.30.40.1\",\n        \"mask\": null,\n        \"cidr\": 32,\n        \"firstIp\": 169748725,\n        \"lastIp\": 169748725,\n        \"interfaceName\": \"null\"\n\t\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "saveDeviceGroupSubnet",
        "jsonExample": "{\n    \"dbId\": 3483567,\n    \"deviceGroupId\": \"7dad2aa5-414a-4b20-86c0-346876ea88b5\",\n    \"subnetIp\": \"10.30.40.1\",\n    \"mask\": null,\n    \"cidr\": 32,\n    \"firstIp\": 169748481,\n    \"lastIp\": 169748481,\n    \"interfaceName\": \"null\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method adds subnet to the Device group.</p>\n<p>Mandatory fields:\n\"deviceGroupId\",\n\"subnetIp\",\n\"cidr\"</p>",
    "examples": {
      "languages": [
        {
          "id": "EemdA63YjUuP6673il0Jl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupSubnet \\\n     --header 'accept: application/json'"
        },
        {
          "id": "QNCRQRn9VbfhJuOFUkChk",
          "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/saveDeviceGroupSubnet\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "g8k0hdN60arTL7NSGD_B8",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupSubnet\")\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": "Y4s_t-rh20ww5_z3UmAMW",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupSubnet\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "EemdA63YjUuP6673il0Jl"
    },
    "results": {
      "languages": [
        {
          "id": "WAoM8qrHSG-F9sbYYsEHV",
          "language": "200",
          "code": "{\n    \"dbId\": 3483567,\n    \"deviceGroupId\": \"7dad2aa5-414a-4b20-86c0-346876ea88b5\",\n    \"subnetIp\": \"10.30.40.1\",\n    \"mask\": null,\n    \"cidr\": 32,\n    \"firstIp\": 169748481,\n    \"lastIp\": 169748481,\n    \"interfaceName\": \"null\"\n}"
        }
      ],
      "selectedLanguageId": "WAoM8qrHSG-F9sbYYsEHV"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}