---
title: Update Devices
slug: single-connect-api-3-2-0/update-devices
description: Learn how to use Curl to easily send a POST request and update devices via a specified URL. This code example demonstrates the inclusion of headers for Accept and Content-Type, with the data being transmitted in JSON format. Enhance your understanding of 
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "15Bf3XCl2h3cHhpqInRt7",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/updateDevices",
    "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    {\n        \"dbId\": 391662,\n        \"id\": \"3b1b99cb-46a9-4f27-83bd-9d7ea14ed3fa\",\n        \"name\": \"10.20.40.167\",\n        \"accessProtocol\": \"SSHv2\",\n        \"managementIp\": \"10.20.40.166\",\n        \"elementType\": {\n            \"dbId\": -1256593,\n            \"elementTypeId\": \"linux\",\n            \"elementTypeName\": \"Linux Server\",\n            \"vendor\": null,\n            \"category\": null,\n            \"elementTypeProperties\": [\n                {\n                    \"dbId\": -316330256,\n                    \"elementTypePropertyValue\": \"-1\",\n                    \"elementTypePropertyKey\": \"shell.terminal.config.fixed_pty_columns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328318769,\n                    \"elementTypePropertyValue\": \".*(?i)password[:|&gt].*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -355141703,\n                    \"elementTypePropertyValue\": \"^Select choice.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328317181,\n                    \"elementTypePropertyValue\": \"^Are you sure.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328315408,\n                    \"elementTypePropertyValue\": \"^Quit.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -224107345,\n                    \"elementTypePropertyValue\": \"abort\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.ctrl_c\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -224107347,\n                    \"elementTypePropertyValue\": \".*?(&gt|\\\\$|#|%)\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.prompt_pattern\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328321729,\n                    \"elementTypePropertyValue\": \"^Enter the date.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -224107346,\n                    \"elementTypePropertyValue\": \"do_nothing\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.ctrl_z\",\n                    \"elementTypePropertyType\": null\n                }\n            ]\n        },\n        \"discoveryTime\": 1542488267577,\n        \"properties\": {\n            \"pseudoDevice\": \"true\"\n        },\n        \"deviceGroups\": [\n            \"feba5a25-7f1b-462e-bb45-711a27783cb0\"\n        ],\n        \"availability\": null,\n        \"currentMaintenanceWindow\": null,\n        \"interfaceName\": null,\n        \"nameManagementIp\": \"10.20.40.166-10.20.40.166\",\n        \"regionName\": null,\n        \"portNum\": null,\n        \"domainController\": null,\n        \"pseudoDevice\": true,\n        \"discoverySource\": null\n    },\n    {\n        \"dbId\": 2660933,\n        \"id\": \"75507a2b-a11d-4ba1-9973-bc4195a08e86\",\n        \"name\": \"10.20.40.248\",\n        \"accessProtocol\": \"SSHv2\",\n        \"managementIp\": \"10.20.40.248\",\n        \"elementType\": {\n            \"dbId\": -1256593,\n            \"elementTypeId\": \"linux\",\n            \"elementTypeName\": \"Linux Server\",\n            \"vendor\": null,\n            \"category\": null,\n            \"elementTypeProperties\": [\n                {\n                    \"dbId\": -316330256,\n                    \"elementTypePropertyValue\": \"-1\",\n                    \"elementTypePropertyKey\": \"shell.terminal.config.fixed_pty_columns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328318769,\n                    \"elementTypePropertyValue\": \".*(?i)password[:|&gt].*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -355141703,\n                    \"elementTypePropertyValue\": \"^Select choice.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328317181,\n                    \"elementTypePropertyValue\": \"^Are you sure.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328315408,\n                    \"elementTypePropertyValue\": \"^Quit.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -224107345,\n                    \"elementTypePropertyValue\": \"abort\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.ctrl_c\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -224107347,\n                    \"elementTypePropertyValue\": \".*?(&gt|\\\\$|#|%)\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.prompt_pattern\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -328321729,\n                    \"elementTypePropertyValue\": \"^Enter the date.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -224107346,\n                    \"elementTypePropertyValue\": \"do_nothing\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.ctrl_z\",\n                    \"elementTypePropertyType\": null\n                }\n            ]\n        },\n        \"discoveryTime\": 1550042482516,\n        \"properties\": {\n            \"pseudoDevice\": \"true\"\n        },\n        \"deviceGroups\": [\n            \"feba5a25-7f1b-462e-bb45-711a27783cb0\"\n        ],\n        \"availability\": null,\n        \"currentMaintenanceWindow\": null,\n        \"interfaceName\": null,\n        \"nameManagementIp\": \"10.20.40.248-10.20.40.248\",\n        \"regionName\": null,\n        \"portNum\": null,\n        \"domainController\": null,\n        \"pseudoDevice\": true,\n        \"discoverySource\": null\n    }\n]",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "updateDevices",
        "jsonExample": "{\n    \"10.20.40.166\": \"Success\",\n    \"10.20.40.248\": \"Success\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method updates devices in Single Connect.</p>\n<p>Copy devices info from getdevice methods.</p>\n<p>Then, change device info to be updated in this method.</p>",
    "examples": {
      "languages": [
        {
          "id": "ju4xVKxzw84UymBYGa8zh",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/updateDevices \\\n     --header 'accept: application/json'"
        },
        {
          "id": "vVi98iEn3qri1kK-ri9X4",
          "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/updateDevices\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "npwvpmmSIaKsqp6ptMaxV",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/updateDevices\")\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": "TetuViX6rREOoKawQ1hlc",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/updateDevices\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "ju4xVKxzw84UymBYGa8zh"
    },
    "results": {
      "languages": [
        {
          "id": "lnnh8twl3YmUxY4iInyk1",
          "language": "200",
          "code": "{\n    \"10.20.40.166\": \"Success\",\n    \"10.20.40.248\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "lnnh8twl3YmUxY4iInyk1"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}