---
title: Login
slug: kron-pam-api-collection-340
docTags: 
createdAt: 2024-07-12T13:38:00.272Z
---

{
  "id": "arvXA64keCErfnxYWurRY",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/login",
    "name": "",
    "description": "<h3>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. <a href=\"https://grey-trinity-199170.postman.co/workspace/My-Workspace~c1372f8e-9fd4-40a5-8ceb-35b3caeef048/documentation/29406512-8d1ecbb2-3dd8-453c-97e4-3fd6673e2880?entity=request-27d93d63-b4d5-4084-8bbe-530ccc84dd52\" target=\"_blank\">Check this request</a> for how to enter your auth code.</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": "{\"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": "rN5K1JFnN5RzuOdxha1TM",
          "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     --header 'x-xsrf-token: {{csrftoken}}' \\\n     --data '\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\"'"
        },
        {
          "id": "c37_2qPuR7nJmeO-PFmfa",
          "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(\"{\\\"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": "xqG9vmchwx4pE1cOyLt0X",
          "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[\"x-xsrf-token\"] = \"{{csrftoken}}\"\nrequest.body = JSON.dump(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "JyGOm3Tqdfk382dnoMl1w",
          "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   'x-xsrf-token': '{{csrftoken}}'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "rN5K1JFnN5RzuOdxha1TM"
    },
    "results": {
      "languages": [
        {
          "id": "MKrkeRFF_0jKDz_TPDoDr",
          "language": "200",
          "code": "{\n    \"sessionId\": \"a8aa28c1-bd5a-4ea3-9490-47cfee4b52ca\"\n}"
        }
      ],
      "selectedLanguageId": "MKrkeRFF_0jKDz_TPDoDr"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}