---
title: Save Device Group Ip Pattern
slug: single-connect-api-3-0-3/save-device-group-ip-pattern
description: Learn how to use the curl command to effortlessly send a POST request and securely save a device group IP pattern with this helpful code example. Discover the step-by-step instructions, including the necessary request headers and data, for achieving a sea
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "48BkLW2Mt1BJxNP-w01lL",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupIpPattern",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Host",
          "type": "string",
          "example": " localhost",
          "description": ""
        },
        {
          "name": "User-Agent",
          "type": "string",
          "example": " Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0",
          "description": ""
        },
        {
          "name": "Accept",
          "type": "string",
          "example": " application/json, text/plain, */*",
          "description": ""
        },
        {
          "name": "Accept-Language",
          "type": "string",
          "example": " en-US,en;q=0.5",
          "description": ""
        },
        {
          "name": "Accept-Encoding",
          "type": "string",
          "example": " gzip, deflate",
          "description": ""
        },
        {
          "name": "Referer",
          "type": "string",
          "example": " http://localhost",
          "description": ""
        },
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        },
        {
          "name": "Connection",
          "type": "string",
          "example": " keep-alive",
          "description": ""
        },
        {
          "name": "Pragma",
          "type": "string",
          "example": " no-cache",
          "description": ""
        },
        {
          "name": "Cache-Control",
          "type": "string",
          "example": " no-cache",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "{\n        \"dbId\": 118263,\n        \"deviceGroupId\": \"d8a5810e-f17e-43f4-8036-86a10c5e2ba0\",\n        \"interfaceName\": null,\n        \"action\": \"ALLOW\",\n        \"ipPattern\": \"^10\\\\.20\\\\.40\\\\.(1([0-9][0-8])|2([0-4][0-8]|5[0-5]))$\"\n    }",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "saveDeviceGroupIpPattern",
        "jsonExample": "{\n    \"dbId\": 140532,\n    \"deviceGroupId\": \"d8a5810e-f17e-43f4-8036-86a10c5e2ba0\",\n    \"interfaceName\": null,\n    \"action\": \"ALLOW\",\n    \"ipPattern\": \"^10\\\\.20\\\\.40\\\\.(1([0-9][0-8])|2([0-4][0-8]|5[0-5]))$\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method adds Ip Pattern to the device group.\nMandatory Fields:</p>\n<p>\"deviceGroupId\"\n\"ipPattern\"</p>",
    "examples": {
      "languages": [
        {
          "id": "1JgSJq4b_lLMmqGiOw3zW",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupIpPattern \\\n     --header 'accept: application/json'"
        },
        {
          "id": "VJMpLsBdUYn8Ff4aOjf23",
          "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/saveDeviceGroupIpPattern\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "CzceO9Dcx_Xuo7U989riT",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupIpPattern\")\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": "5VQ8OEDwEzZBpUA0xYdDi",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/saveDeviceGroupIpPattern\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "1JgSJq4b_lLMmqGiOw3zW"
    },
    "results": {
      "languages": [
        {
          "id": "_YuY2p_oKpeo7kYdRH-Gj",
          "language": "200",
          "code": "{\n    \"dbId\": 140532,\n    \"deviceGroupId\": \"d8a5810e-f17e-43f4-8036-86a10c5e2ba0\",\n    \"interfaceName\": null,\n    \"action\": \"ALLOW\",\n    \"ipPattern\": \"^10\\\\.20\\\\.40\\\\.(1([0-9][0-8])|2([0-4][0-8]|5[0-5]))$\"\n}"
        }
      ],
      "selectedLanguageId": "_YuY2p_oKpeo7kYdRH-Gj"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}