---
title: Login
slug: single-connect-api-3-0-3
description: Learn how to make a POST request to a login endpoint using cURL command with a JSON body. This handy code example includes the essential headers and URL to execute the request effortlessly. Master the art of API calls and enhance your web development skil
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "D5i1mrGsM3v2eEoAHl8jS",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/login",
    "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": "{\"username\":\"admin\",\"password\":\"admin\"}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Login",
        "jsonExample": "{\n    \"sessionId\": \"a8aa28c1-bd5a-4ea3-9490-47cfee4b52ca\"\n}"
      }
    ],
    "contentType": "application/json",
    "description": "This method authenticates a user to Single Connect.",
    "examples": {
      "languages": [
        {
          "id": "jJABfpalZzp5Ait_usxxU",
          "language": "curl",
          "label": "cURL",
          "code": "curl --location --globoff '{{url}}/aioc-rest-web/rest/login' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\"body\":\"string\"}'"
        },
        {
          "id": "KfO0Ad7Bm8oOsb1V99YxQ",
          "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({\n   \"body\": \"string\"\n});\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": "HSzCvoOa_EoQDf0VKqOVK",
          "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({\n   \"body\": \"string\"\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "RhWlLTopByAYoWG0mGuSl",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/login\"\n\npayload = json.dumps({\n   \"body\": \"string\"\n})\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": "jJABfpalZzp5Ait_usxxU"
    },
    "results": {
      "languages": [
        {
          "id": "579hTyTgfCM9yfDT0Ud4L",
          "language": "200",
          "code": "{\n    \"sessionId\": \"a8aa28c1-bd5a-4ea3-9490-47cfee4b52ca\"\n}"
        }
      ],
      "selectedLanguageId": "579hTyTgfCM9yfDT0Ud4L"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}