Authentication
Authenticate to the Polarity v5 REST API
Overview
Authenticating
POST /api/users/login{
"identification": "<USERNAME>",
"password":"<PASSWORD>"
}Examples
curl -v -X POST https://<polarity-server>/api/users/login \
--header 'Content-Type: application/vnd.api+json' \
--data '{"identification": "<USERNAME>", "password":"<PASSWORD>"}'def get_auth_token(username, password, host):
url = f"{host}/api/users/login"
payload = json.dumps({
"identification": username,
"password": password
})
headers = {
'Content-Type': 'application/vnd.api+json'
}
response = requests.request("POST", url, headers=headers, data=payload)
response.raise_for_status()
body = response.json()
return body['data']['token'];
token = get_auth_token('username', 'password', 'https://my-server') Return Payload
HTTP Status Codes
Status Code
Result
Refreshing a Token
Examples
Invalidating a Token
Examples
Last updated