---
title: Logs user into the system
slug: custom-main-prod/logs-user-into-the-system
createdAt: 2025-06-24T07:41:50.939Z
---

{
  "id": "j3hMGIWSuaKCRzSClhSPD",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "//petstore.swagger.io/v2/user/login",
    "servers": [
      {
        "url": "//petstore.swagger.io/v2/user/login",
        "description": "Default server"
      },
      {
        "url": "//petstore.swagger.io/sandbox/user/login",
        "description": "Sandbox server"
      }
    ],
    "name": "Logs user into the system",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [
        {
          "kind": "required",
          "name": "username",
          "type": "string",
          "description": "The user name for login"
        },
        {
          "kind": "required",
          "name": "password",
          "type": "string",
          "description": "The password for login in clear text"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "response",
            "code": "OK"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "string",
            "description": "",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid username/password supplied",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url '//petstore.swagger.io/v2/user/login?username=string&password=string' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"//petstore.swagger.io/v2/user/login?username=string&password=string\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"//petstore.swagger.io/v2/user/login?username=string&password=string\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"//petstore.swagger.io/v2/user/login?username=string&password=string\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// successful operation\n\"\"",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// successful operation\n\"\""
            },
            {
              "label": "response",
              "code": "OK"
            }
          ]
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid username/password supplied\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}