Authentication

POST
Role permissions

This operation is permitted for all user roles.

Headers
Content-Type: application/json
Accept: application/json
Body
  • For Login / Password authentication, the following keys are required:

    • login_id: Email address associated with user
    • password: User’s password
    • api_key: API key (Setup / Manage API Keys web page)
  • Optional keys:
    • no_cookies: Value not used. Session cookie header will not be returned; instead a token will be returned in the response body.

Calling /v2/login with a POST will log in and produce login cookies to identify the user's logged-in state. The cookies must be passed in with subsequent requests to the other API endpoints. Cookie sessions last for 24 hours. If no_cookies is specified, the returned token must be saved and from then on, token=<<RETURNED TOKEN>> is added to the URL parameters for each following request.

HTTP Response

200 OK

  • The user is successfully logged in. The response body will contain: true. However if no_cookies is specified, the return value will be the token.

400 BAD REQUEST

  • The request was missing login_id/password/key parameters.

400 UNAUTHORIZED

  • The parameters contained invalid data, or the password didn’t match

403 FORBIDDEN

  • No user matching login_id can be found or insufficient permissions to login.

500 SERVER ERROR

  • Could not complete the request due to an internal server error.

503 SERVICE UNAVAILABLE

  • Temporarily unable to complete the login request. Please try again.
Examples:

Curl

#!/bin/sh
curl -c cookie_user.txt -i -X POST -d '{"login_id":"john.doe@mediumone.com","password":"12345","api_key":"ABCDEFGHIJKLmnopabcdefghijklmnop1234567890"}' https://api.mediumone.com/v2/login/ --header "Content-Type: application/json"

Python

import requests
import json

headers ={'Content-Type': 'application/json', 'Accept': 'application/json'}
data = {'login_id': 'john.doe@mediumone.com', 'password': '12345', 'api_key': 'ABCDEFGHIJKLmnopabcdefghijklmnop1234567890'}

session = requests.session()
response = session.post('https://api.mediumone.com/v2/login', data=json.dumps(data), headers=headers)

Curl

#!/bin/sh
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' 'https://api.mediumone.com/v2/login?no_cookies' -d '{"login_id": "john.doe@mediumone.com", "password": "12345", "api_key": "ABCDEFGHIJKLmnopabcdefghijklmnop1234567890"}'

Python

import requests
import json

headers ={'Content-Type': 'application/json', 'Accept': 'application/json'}
data = {'login_id': 'john.doe@mediumone.com', 'password': '12345', 'api_key': 'ABCDEFGHIJKLmnopabcdefghijklmnop1234567890'}

session = requests.session()
response = session.post('https://api.mediumone.com/v2/login?no_cookies', data=json.dumps(data), headers=headers)