Authentication

Logs user into Medium One API and produces login cookies to identify the user's logged in state. The cookies must be passed in with subsequent requests to the other API endpoints. If no_cookies is specified, the returned token must be saved and from then on, token=<RETURNED TOKEN> must be added to the URL parameters for each following request.

Note: Cookie sessions last for 24 hours.
 

Login

Summary

  • Endpoint: /v2/login
  • Method: POST
  • Permissions: This operation is permitted for all user roles.
     
 

 

Headers

Content-Type: application/json
Accept: application/json

Body

  • login_id (required): Email address associated with user
  • password (required): User’s password
  • api_key(required): Enabled API key for project
  • no_cookies: Value not used. Session cookie header will not be returned; instead a token will be returned in the response body.
 

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)