Store

/v2/store/login_id

The /v2/store/login_id endpoint is used for creation, retrieval, and update of Store data.

login_id is optional. If not specified, the API commands operate on the global Store data. If specified, the API commands operate on the Store data for the specified user.

Role permissions

Users with the roles of Business User or Basic User are permitted for the below operations.

GET
Headers
Accept: application/json
Cookies: < login cookies >
Path

URL-encoded parameters, all optional:

  • key: Store key to retrieve
HTTP RESPONSE

200 OK

  • if key was not specified, a JSON list of the existing Store keys is returned
  • if key was specified, a JSON object with fields "key" and "value" will be returned with associated values of key and the data associated with the Store key, respectively.
    ["foo", "bar"]
    {"key": "foo", "value": "123"}

400 BAD REQUEST

  • The request was missing parameters.

401 UNAUTHORIZED

  • No authorized user is currently logged in.

403 FORBIDDEN

  • No user matching login_id can be found or insufficient permissions to view that user’s data.

404 NOT FOUND

  • No user matching login_id can be found.

500 SERVER ERROR

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

503 SERVICE UNAVAILABLE

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

Curl

# login as API Basic User and save session cookies
curl -c cookies.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"

# get data
curl -b cookies.txt -X GET -k -H 'Accept: application/json' 'https://api.mediumone.com/v2/store?key=foo'

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'}

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

url = 'https://api.mediumone.com/v2/store'
headers = {'Accept': 'application/json'}
params = {"key":"foo"}

# GET
response = session.get(url=url, params=params, headers=headers)
POST
Headers
Content-Type: application/json
Accept: application/json
Cookies: < login cookies >
Body

A json object containing fields "key", "value", and "operation", set to the Store key to update/create, the "value" to associate, and the "operation" to use when associating. "operation" must be one of "set" or "incr", where "set" associates the value specified by "value" with the key and "incr" increments the existing value (0 if it doesn't exist) by the value specified by "value". Can be multiple items, one JSON document per line (with newline character between each JSON document). The POST body has a maximum limit of 10MB.

  • Example of single item

    {"key": "foo", "value": "123", "operation": "set"}
  • Example of multiple data events:

    CORRECT

    {"key": "foo", "value": "123", "operation": "set"}
    {"key": "bar", "value": 5, "operation": "incr"}

    INCORRECT

    {"key": "foo", "value": "123", "operation": "set"}{"key": "bar", "value": 5, "operation": "incr"}

Notes on specific key/value fields:

  • key must be a string meeting Store requirements

  • value must be a value meeting Store requirements or a number if operation is set to "incr"
HTTP Response

200 OK

  • Store entry successfully created/updated

400 BAD REQUEST

  • The request was missing parameters.

401 UNAUTHORIZED

  • No authorized user is currently logged in.

403 FORBIDDEN

  • No user matching login_id can be found or not authorized to post data for the given user.

404 NOT FOUND

  • No user matching login_id can be found.

500 SERVER ERROR

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

503 SERVICE UNAVAILABLE

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

Curl

# login as API Basic User and save session cookies
curl -c cookies.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"

# send data
curl -b cookies.txt -X POST -k -H 'Content-Type: application/json' -i https://api.mediumone.com/v2/store/john.doe@mediumone.com -d '{"key": "foo", "value": "123", "operation": "set"}'

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.comv2/login', data=json.dumps(data), headers=headers)

url = 'https://api.mediumone.com/v2/store/john.doe@mediumone.com'
data = {"key": "foo", "value": "123", "operation": "set"}

response = session.post(url=url, data=json.dumps(data), headers=headers)
DELETE
Headers
Content-Type: application/json
Accept: application/json
Cookies: < login cookies >
Body

A JSON object containing field "key" set to the Store key to delete. Can be multiple items, one JSON document per line (with newline character between each JSON document). The POST body has a maximum limit of 10MB.

  • Example of a single item

    {"key": "foo"}
  • Example of multiple items:

    CORRECT

    {"key": "foo"}
    {"key": "bar"}

    INCORRECT

    {"key": "foo"}{"key": "bar"}

Notes on specific key/value fields:

  • key must be a string meeting Store requirements
HTTP Response

200 OK

  • Store entry successfully deleted

400 BAD REQUEST

  • The request was missing parameters.

401 UNAUTHORIZED

  • No authorized user is currently logged in.

403 FORBIDDEN

  • No user matching login_id can be found or not authorized to post data for the given user.

404 NOT FOUND

  • No user matching login_id can be found.

500 SERVER ERROR

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

503 SERVICE UNAVAILABLE

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

Curl

# login as API Basic User and save session cookies
curl -c cookies.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"

# send data
curl -b cookies.txt -X DELETE -k -H 'Content-Type: application/json' -i https://api.mediumone.com/v2/store/john.doe@mediumone.com -d '{"key": "foo"}'

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.comv2/login', data=json.dumps(data), headers=headers)

url = 'https://api.mediumone.com/v2/store/john.doe@mediumone.com'
data = {"key": "foo"}

response = session.delete(url=url, data=json.dumps(data), headers=headers)