---
title: Login
slug: kronpam-api-collection-3-6-0
docTags: 
createdAt: 2025-01-20T13:35:40.974Z
---

{
  "id": "9u2xKGfspMeKghyMrXpRV",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/login",
    "name": "",
    "description": "<h3>Request Overview</h3>\n<p>The login method is the primary gateway to the KRON PAM system. Before accessing any other functionalities or methods, users must authenticate themselves using this method by username and password.</p>\n<p>Successfully logging in provides the user with a session ID, which is essential for subsequent interactions with the system.</p>\n<p><strong>Note:</strong> If you enabled OTP, you must enter your 6-digit code due to MFA.</p>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "Content-Type",
          "description": "",
          "default": "application/json",
          "value": "application/json",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "description": "",
          "default": "{\"username\":\"{{TestUserName}}\",\"password\":\"{{TestUserPassword}}\"}",
          "value": "{\"username\":\"{{TestUserName}}\",\"password\":\"{{TestUserPassword}}\"}",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Login",
        "jsonExample": "{\n    \"sessionId\": \"a8aa28c1-bd5a-4ea3-9490-47cfee4b52ca\"\n}"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "K4WDGOywMdnIcKDoizrCu",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/login \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\"'"
        },
        {
          "id": "LV9PNqshotJOp1nIeA6Lk",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/login\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "WN2rwlKiATBbZrT5nSXJW",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/login\")\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.body = JSON.dump(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ZDZBpPDSbsBbaUnYlAheL",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/login\"\n\npayload = json.dumps(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\")\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "K4WDGOywMdnIcKDoizrCu"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n    \"sessionId\": \"a8aa28c1-bd5a-4ea3-9490-47cfee4b52ca\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}