---
title: Add Sapm Account to Sapm Group
slug: single-connect-api-3-0-3/add-sapm-account-to-sapm-group
description: Learn how to make a POST request using curl and add a SAPM account to a SAPM group with ease. This document offers comprehensive code examples, including headers for smooth acceptance and sending of JSON data. Boost your programming skills today!
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "vN7w79n-tpaHt11d_YvNK",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/sc/sapm/addSapmAccountToSapmGroup",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        },
        {
          "name": "Cookie",
          "type": "string",
          "example": "{{netrightCookie}} ",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "{\t\n\t\"sapmDbId\":85613,\n\t\"sapmGroupDbId\":85220\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>sapm/addSapmAccount</p>",
        "jsonExample": "{\n    \"dbId\": 608679,\n    \"device\": {\n        \"dbId\": 602107,\n        \"id\": \"4b144118-2505-43a9-908a-b6fab60f296f\",\n        \"name\": \"10.20.40.184\",\n        \"accessProtocol\": \"SSHv2\",\n        \"managementIp\": \"10.20.40.184\",\n        \"elementType\": {\n            \"dbId\": -1256593,\n            \"elementTypeId\": \"linux\",\n            \"elementTypeName\": \"Linux Server\",\n            \"vendor\": null,\n            \"category\": null,\n            \"elementTypeProperties\": [\n                {\n                    \"dbId\": 279310,\n                    \"elementTypePropertyValue\": \"hostname\",\n                    \"elementTypePropertyKey\": \"discovery.commands.hostname\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": 279363,\n                    \"elementTypePropertyValue\": \"uname\",\n                    \"elementTypePropertyKey\": \"discovery.commands.version.command\",\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\": -328321729,\n                    \"elementTypePropertyValue\": \"^Enter the date.*\",\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\": -328318769,\n                    \"elementTypePropertyValue\": \".*(?i)password[:|&gt].*\",\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                    \"dbId\": -224107347,\n                    \"elementTypePropertyValue\": \".*?(&gt|\\\\$|#|%)\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.prompt_pattern\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -316330256,\n                    \"elementTypePropertyValue\": \"-1\",\n                    \"elementTypePropertyKey\": \"shell.terminal.config.fixed_pty_columns\",\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\": -355141703,\n                    \"elementTypePropertyValue\": \"^Select choice.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": 279374,\n                    \"elementTypePropertyValue\": \"Linux\",\n                    \"elementTypePropertyKey\": \"discovery.model.match.regex\",\n                    \"elementTypePropertyType\": null\n                }\n            ]\n        },\n        \"discoveryTime\": 1548839906588,\n        \"properties\": {\n            \"pseudoDevice\": \"true\"\n        },\n        \"deviceGroups\": [\n            \"4dd39f0b-2cb1-4089-8281-3912e7b904e0\"\n        ],\n        \"availability\": null,\n        \"currentMaintenanceWindow\": null,\n        \"interfaceName\": null,\n        \"nameManagementIp\": \"10.20.40.184-10.20.40.184\",\n        \"regionName\": null,\n        \"pseudoDevice\": true,\n        \"domainController\": null,\n        \"portNum\": null,\n        \"discoverySource\": null\n    },\n    \"config\": {\n        \"configId\": -9077,\n        \"name\": \"Linux\",\n        \"description\": \"Linux\",\n        \"strategy\": \"SSH\",\n        \"properties\": {\n            \"username.parser\": \"(.*?):.*\",\n            \"new.user.found.action\": \"LOG\",\n            \"user.list.command\": \"cat /etc/passwd\",\n            \"check.password.validation\": \"true\",\n            \"change.password.command.template\": \"passwd\\\\n${oldPassword}\\\\n${newPassword}\\\\n${newPassword}\\\\nlogout\"\n        },\n        \"exactMatch4Search\": false,\n        \"recordLimit4Search\": null\n    },\n    \"changePeriod\": 7200,\n    \"username\": \"sapm2\",\n    \"password\": \"5B5bycR3kOdleJw0UI86BQ==\",\n    \"previousPassword\": \"IGrfdOMqFwhnVxTYOTFVKA==\",\n    \"lastChangeTime\": 1548853978693,\n    \"nextChangeTime\": 1549285978693,\n    \"nextChangeTimeStart4Search\": null,\n    \"nextChangeTimeEnd4Search\": null,\n    \"passwordSeenStatus\": \"UNSEEN\",\n    \"validationStatus\": \"VALID\",\n    \"changeStatus\": null,\n    \"lastAttemptStatus\": true,\n    \"masterAccountId\": null,\n    \"permissions\": {},\n    \"identicalSapmAccounts\": [],\n    \"recordLimit4Search\": null,\n    \"validationStatus4Search\": null,\n    \"checkPermission4Search\": true,\n    \"exactMatch4Search\": false,\n    \"acceptedSapmConfigList\": null,\n    \"masterAccountId4Search\": null,\n    \"searchOnlyMasterAccounts\": false,\n    \"searchOnlyOwnRegion\": false,\n    \"deviceIp4Search\": null,\n    \"secondPartSeenUsername\": null,\n    \"firstPartSeenUsername\": null,\n    \"changePeriodFormatted\": \"05d 00h 00m\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "This API will add SAPM account to given SAPM group.",
    "examples": {
      "languages": [
        {
          "id": "JCc4aS6naDWT-R1RQcdft",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/sapm/addSapmAccountToSapmGroup \\\n     --header 'accept: application/json'"
        },
        {
          "id": "42_6gYyZkfV7yGlm7s33x",
          "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/sc/sapm/addSapmAccountToSapmGroup\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ERgZmqwWB2lUxnDLWflSm",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/sc/sapm/addSapmAccountToSapmGroup\")\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": "4X67Tfw_XIYGIwVWpSCo3",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/sapm/addSapmAccountToSapmGroup\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "JCc4aS6naDWT-R1RQcdft"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n    \"dbId\": 608679,\n    \"device\": {\n        \"dbId\": 602107,\n        \"id\": \"4b144118-2505-43a9-908a-b6fab60f296f\",\n        \"name\": \"10.20.40.184\",\n        \"accessProtocol\": \"SSHv2\",\n        \"managementIp\": \"10.20.40.184\",\n        \"elementType\": {\n            \"dbId\": -1256593,\n            \"elementTypeId\": \"linux\",\n            \"elementTypeName\": \"Linux Server\",\n            \"vendor\": null,\n            \"category\": null,\n            \"elementTypeProperties\": [\n                {\n                    \"dbId\": 279310,\n                    \"elementTypePropertyValue\": \"hostname\",\n                    \"elementTypePropertyKey\": \"discovery.commands.hostname\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": 279363,\n                    \"elementTypePropertyValue\": \"uname\",\n                    \"elementTypePropertyKey\": \"discovery.commands.version.command\",\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\": -328321729,\n                    \"elementTypePropertyValue\": \"^Enter the date.*\",\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\": -328318769,\n                    \"elementTypePropertyValue\": \".*(?i)password[:|&gt].*\",\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                    \"dbId\": -224107347,\n                    \"elementTypePropertyValue\": \".*?(&gt|\\\\$|#|%)\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.prompt_pattern\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": -316330256,\n                    \"elementTypePropertyValue\": \"-1\",\n                    \"elementTypePropertyKey\": \"shell.terminal.config.fixed_pty_columns\",\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\": -355141703,\n                    \"elementTypePropertyValue\": \"^Select choice.*\",\n                    \"elementTypePropertyKey\": \"enforcer.terminal.behaviour.exc_last_line_patterns\",\n                    \"elementTypePropertyType\": null\n                },\n                {\n                    \"dbId\": 279374,\n                    \"elementTypePropertyValue\": \"Linux\",\n                    \"elementTypePropertyKey\": \"discovery.model.match.regex\",\n                    \"elementTypePropertyType\": null\n                }\n            ]\n        },\n        \"discoveryTime\": 1548839906588,\n        \"properties\": {\n            \"pseudoDevice\": \"true\"\n        },\n        \"deviceGroups\": [\n            \"4dd39f0b-2cb1-4089-8281-3912e7b904e0\"\n        ],\n        \"availability\": null,\n        \"currentMaintenanceWindow\": null,\n        \"interfaceName\": null,\n        \"nameManagementIp\": \"10.20.40.184-10.20.40.184\",\n        \"regionName\": null,\n        \"pseudoDevice\": true,\n        \"domainController\": null,\n        \"portNum\": null,\n        \"discoverySource\": null\n    },\n    \"config\": {\n        \"configId\": -9077,\n        \"name\": \"Linux\",\n        \"description\": \"Linux\",\n        \"strategy\": \"SSH\",\n        \"properties\": {\n            \"username.parser\": \"(.*?):.*\",\n            \"new.user.found.action\": \"LOG\",\n            \"user.list.command\": \"cat /etc/passwd\",\n            \"check.password.validation\": \"true\",\n            \"change.password.command.template\": \"passwd\\\\n${oldPassword}\\\\n${newPassword}\\\\n${newPassword}\\\\nlogout\"\n        },\n        \"exactMatch4Search\": false,\n        \"recordLimit4Search\": null\n    },\n    \"changePeriod\": 7200,\n    \"username\": \"sapm2\",\n    \"password\": \"5B5bycR3kOdleJw0UI86BQ==\",\n    \"previousPassword\": \"IGrfdOMqFwhnVxTYOTFVKA==\",\n    \"lastChangeTime\": 1548853978693,\n    \"nextChangeTime\": 1549285978693,\n    \"nextChangeTimeStart4Search\": null,\n    \"nextChangeTimeEnd4Search\": null,\n    \"passwordSeenStatus\": \"UNSEEN\",\n    \"validationStatus\": \"VALID\",\n    \"changeStatus\": null,\n    \"lastAttemptStatus\": true,\n    \"masterAccountId\": null,\n    \"permissions\": {},\n    \"identicalSapmAccounts\": [],\n    \"recordLimit4Search\": null,\n    \"validationStatus4Search\": null,\n    \"checkPermission4Search\": true,\n    \"exactMatch4Search\": false,\n    \"acceptedSapmConfigList\": null,\n    \"masterAccountId4Search\": null,\n    \"searchOnlyMasterAccounts\": false,\n    \"searchOnlyOwnRegion\": false,\n    \"deviceIp4Search\": null,\n    \"secondPartSeenUsername\": null,\n    \"firstPartSeenUsername\": null,\n    \"changePeriodFormatted\": \"05d 00h 00m\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}