---
title: Save User Group
slug: single-connect-api-3-0-3/save-user-group
description: Learn how to use the curl command to effortlessly make a POST request and save a user group in this code example. Discover the required headers and data to include for a successful request. Master the art of API integration with ease!
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "eVI9fHIVpMgijDJ51RJyN",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/user/saveUserGroup",
    "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": "{\r\n\t\"eid\": \"UG_create\",\r\n    \"users\": [\r\n        {\r\n            \"id\": \"3f53ceec-3c3a-40a5-961a-a1ea0ec8f6de\"\r\n            \r\n        }\r\n            ],\r\n    \"managers\": [\r\n        {\r\n            \"id\": \"3f53ceec-3c3a-40a5-961a-a1ea0ec8f6de\"\r\n        }\r\n        \t]\r\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Add/Change User's Groups</p>",
        "jsonExample": "{\n    \"id\": \"a177be61-8850-4f03-be1c-3ce275f02c1f\",\n    \"eid\": \"testuser\",\n    \"personelId\": \"123123\",\n    \"name\": \"test\",\n    \"passwordAlgorithm\": \"MD5\",\n    \"password\": \"21232f297a57a5a743894a0e4a801fc3\",\n    \"email\": \"test@test.com\",\n    \"surname\": \"user\",\n    \"internal\": true,\n    \"properties\": {\n        \"phoneNumber\": \"5550000000\",\n        \"ubaThreshold\": \"50\"\n    },\n    \"groups\": [\n        \"DEFAULT_GROUP_SYSYEM_ADMINS\",\n        \"DEFAULT_GROUP_SYSYEM_USERS\"\n    ],\n    \"managerGroups\": [],\n    \"lastLogin\": null,\n    \"lastLoginIp\": null,\n    \"recordLimit4Search\": null,\n    \"passwordDirty\": false,\n    \"passwordAutoGenerated\": false,\n    \"phoneNumber\": \"5550000000\",\n    \"forceChangePasswordOnNextLogin\": false,\n    \"lockReason\": null,\n    \"unlockOnPasswordChanged\": false,\n    \"unlockTime\": null,\n    \"tempUserEndTime\": null,\n    \"tempUserStartTime\": null,\n    \"tempUser\": false,\n    \"externalDirectorySource\": null,\n    \"userPropertyKey4Search\": null,\n    \"userPropertyValue4Search\": null,\n    \"locked\": false\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method adds/changes a chosen user to an existing user group in Single Connect.</p>\n<p>Copy the response of \"Get User Details By Id\" request to \"Body\" field. Edit \"groups\" info, then send the request.</p>",
    "examples": {
      "languages": [
        {
          "id": "mtS6NJDQXRrND6TC95vHa",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/user/saveUserGroup \\\n     --header 'accept: application/json'"
        },
        {
          "id": "65mCA-Td_tsHkJKdUZfp9",
          "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/user/saveUserGroup\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "KBp61XEN4eD7o8U8VAg3p",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/user/saveUserGroup\")\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": "oVnWJERq7ep7zMcib32pu",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/user/saveUserGroup\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "mtS6NJDQXRrND6TC95vHa"
    },
    "results": {
      "languages": [
        {
          "id": "HrWoWsbxOA0TMlpb9RQIj",
          "language": "200",
          "code": "{\n    \"id\": \"a177be61-8850-4f03-be1c-3ce275f02c1f\",\n    \"eid\": \"testuser\",\n    \"personelId\": \"123123\",\n    \"name\": \"test\",\n    \"passwordAlgorithm\": \"MD5\",\n    \"password\": \"21232f297a57a5a743894a0e4a801fc3\",\n    \"email\": \"test@test.com\",\n    \"surname\": \"user\",\n    \"internal\": true,\n    \"properties\": {\n        \"phoneNumber\": \"5550000000\",\n        \"ubaThreshold\": \"50\"\n    },\n    \"groups\": [\n        \"DEFAULT_GROUP_SYSYEM_ADMINS\",\n        \"DEFAULT_GROUP_SYSYEM_USERS\"\n    ],\n    \"managerGroups\": [],\n    \"lastLogin\": null,\n    \"lastLoginIp\": null,\n    \"recordLimit4Search\": null,\n    \"passwordDirty\": false,\n    \"passwordAutoGenerated\": false,\n    \"phoneNumber\": \"5550000000\",\n    \"forceChangePasswordOnNextLogin\": false,\n    \"lockReason\": null,\n    \"unlockOnPasswordChanged\": false,\n    \"unlockTime\": null,\n    \"tempUserEndTime\": null,\n    \"tempUserStartTime\": null,\n    \"tempUser\": false,\n    \"externalDirectorySource\": null,\n    \"userPropertyKey4Search\": null,\n    \"userPropertyValue4Search\": null,\n    \"locked\": false\n}"
        }
      ],
      "selectedLanguageId": "HrWoWsbxOA0TMlpb9RQIj"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}