---
title: Save New Devices
slug: kronpam-api-collection-350/save-new-devices
docTags: 
createdAt: 2024-07-22T09:58:47.220Z
---

{
  "id": "oOyR7hadkR5d7ZubWVS2N",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/discovery/saveDevices",
    "name": "",
    "description": "<p>This method adds a new device in KRON PAM.\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>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "Content-Type",
          "description": "",
          "default": "application/json",
          "value": "application/json",
          "type": "string"
        },
        {
          "name": "X-XSRF-TOKEN",
          "description": "",
          "default": "{{csrftoken}}",
          "value": "{{csrftoken}}",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "description": "",
          "default": "[\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]",
          "value": "[\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]",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "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}"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "cD1vILbvecoO86bMXHfyb",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/discovery/saveDevices \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-xsrf-token: {{csrftoken}}' \\\n     --data '\"[\\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]\"'"
        },
        {
          "id": "yFRLGffzyCVl8lD_A_AX8",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-xsrf-token\", \"{{csrftoken}}\");\n\nvar raw = JSON.stringify(\"[\\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]\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\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": "nSAKstSsOtiuvgW-Xi-hT",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\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\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-xsrf-token\"] = \"{{csrftoken}}\"\nrequest.body = JSON.dump(\"[\\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]\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "UiIIj66P0LRxiIezQdgkp",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/discovery/saveDevices\"\n\npayload = json.dumps(\"[\\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]\")\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-xsrf-token': '{{csrftoken}}'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "cD1vILbvecoO86bMXHfyb"
    },
    "results": {
      "languages": [
        {
          "id": "4UIv3ByLM1weJQc0WAm5K",
          "language": "200",
          "code": "{\n    \"18.18.18.18\": \"Success\",\n    \"19.19.19.19\": \"Success\",\n    \"17.17.17.17\": \"Success\"\n}"
        },
        {
          "id": "qURgezwiC3R46u7fM-rtB",
          "language": "200",
          "code": "{\n    \"111.111.11.11\": \"Success\",\n    \"12.12.12.12\": \"Success\",\n    \"123.123.123.123\": \"Success\"\n}"
        }
      ],
      "selectedLanguageId": "4UIv3ByLM1weJQc0WAm5K"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}