---
title: Save New Devices
slug: single-connect-api-3-2-0/save-new-devices
description: This document offers a code example demonstrating the usage of curl for making a POST request to a targeted URL. The request is structured as a JSON object, allowing for seamless data transmission. Improve your coding skills and enhance your understanding
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "cZDOOXRWjeWJLaPjyzUlo",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/discovery/saveDevices",
    "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\n{\n    \n    \"managementIp\": \"155.17.17.17\",\n    \n    \"accessProtocol\": \"RDP\",\n    \"elementType\": {\n          \"elementTypeId\": \"windows\"\n        },\n    \"deviceGroups\": [\n        \"8851fead-2b5e-4769-b847-fc8a898999a0\"\n    ],\n    \"pseudoDevice\": true\n}\n    \n]",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Add Devices",
        "jsonExample": "{\n    \"18.18.18.18\": \"Success\",\n    \"19.19.19.19\": \"Success\",\n    \"17.17.17.17\": \"Success\"\n}"
      },
      {
        "statusCode": "200",
        "description": "saveDevices",
        "jsonExample": "{\n    \"111.111.11.11\": \"Success\",\n    \"12.12.12.12\": \"Success\",\n    \"123.123.123.123\": \"Success\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method adds a new device in Single Connect.\nMany devices as bulk import can be add in one request body by posting device information in many curly arrays.</p>\n<p>Mandatory fields:</p>\n<p>\"managementIp\": \"18.18.18.18\",</p>\n<p>\"accessProtocol\": \"TELNET\",</p>\n<p>\"elementType\": {\n\"elementTypeId\": \"cisco_ios\"}</p>",
    "examples": {
      "languages": [
        {
          "id": "sag8AaN0eHF4AN7Kxq9Lf",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/saveDevices \\\n     --header 'accept: application/json'"
        },
        {
          "id": "hkTMT1D1EnjkPfUcu5ik8",
          "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/saveDevices\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "tPsFNF9jEMdGQccjCNnDo",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/discovery/saveDevices\")\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": "2hiUO-QWjd9eEalKKCFbN",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/saveDevices\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "sag8AaN0eHF4AN7Kxq9Lf"
    },
    "results": {
      "languages": [
        {
          "id": "axjcSIIrl3e3Z7lTj2_sK",
          "language": "200",
          "code": "{\n    \"18.18.18.18\": \"Success\",\n    \"19.19.19.19\": \"Success\",\n    \"17.17.17.17\": \"Success\"\n}"
        },
        {
          "id": "viP_PHZHj9FHeujgy-NP6",
          "language": "200",
          "code": "{\n    \"111.111.11.11\": \"Success\",\n    \"12.12.12.12\": \"Success\",\n    \"123.123.123.123\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "axjcSIIrl3e3Z7lTj2_sK"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}