---
title: Lock Users
slug: kronpam-api-collection-350/lock-users
docTags: 
createdAt: 2024-07-22T09:58:47.220Z
---

{
  "id": "1PeVVbH76ICfn6UpUEeEN",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/user/lockUsers/reasonToLockThem",
    "name": "",
    "description": "<h3>Overview</h3>\n<p><strong>This method locks an existing user.</strong></p>\n<p>Enter the user <code>id</code> in \"Body\" field. Multiple users can be locked at the same time. For this option, use a comma separator for <code>id</code> of users.</p>\n<blockquote>\n<p>Ex: [\"user1id\", \"user2id\", \"user3id\"]</p>\n</blockquote>",
    "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": "[\"40f354c6-b510-437e-9ee6-4f9b9724e654\"]",
          "value": "[\"40f354c6-b510-437e-9ee6-4f9b9724e654\"]",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Lock Users",
        "jsonExample": "[\n    {\n        \"id\": \"cdc00366-56b6-4874-bd8b-7862549510ab\",\n        \"eid\": \"testuser\",\n        \"personelId\": \"123123\",\n        \"name\": \"testtest\",\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            \"lockReason\": \"Locked by admin\",\n            \"forcePasswordChangeOnNextLogin\": \"true\",\n            \"isLocked\": \"true\"\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\": true,\n        \"lockReason\": \"Locked by admin\",\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\": true\n    }\n]"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "biZeo_EUhWFmaICBEc9MQ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/user/lockUsers/reasonToLockThem \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-xsrf-token: {{csrftoken}}' \\\n     --data '\"[\\\"40f354c6-b510-437e-9ee6-4f9b9724e654\\\"]\"'"
        },
        {
          "id": "YkmdXitKnhJG-Dkqc8dVy",
          "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(\"[\\\"40f354c6-b510-437e-9ee6-4f9b9724e654\\\"]\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/user/lockUsers/reasonToLockThem\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "p-t84j0qOME7fyl_2rHV5",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/user/lockUsers/reasonToLockThem\")\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(\"[\\\"40f354c6-b510-437e-9ee6-4f9b9724e654\\\"]\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "om9AKLdq6MKvL1yIe29yS",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/user/lockUsers/reasonToLockThem\"\n\npayload = json.dumps(\"[\\\"40f354c6-b510-437e-9ee6-4f9b9724e654\\\"]\")\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": "biZeo_EUhWFmaICBEc9MQ"
    },
    "results": {
      "languages": [
        {
          "id": "0954EQv3by3G0zAXGtTXx",
          "language": "200",
          "code": "[\n    {\n        \"id\": \"cdc00366-56b6-4874-bd8b-7862549510ab\",\n        \"eid\": \"testuser\",\n        \"personelId\": \"123123\",\n        \"name\": \"testtest\",\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            \"lockReason\": \"Locked by admin\",\n            \"forcePasswordChangeOnNextLogin\": \"true\",\n            \"isLocked\": \"true\"\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\": true,\n        \"lockReason\": \"Locked by admin\",\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\": true\n    }\n]"
        }
      ],
      "selectedLanguageId": "0954EQv3by3G0zAXGtTXx"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}