Edgio

Initializing HMAC Key Pairs in the JSON-RPC interface

Method name: initKeyPair
Generates a paired access key and secret key on a per account basis, replacing any previously generated key pairs. Use the key pair when creating signed requests.
The secret key, once generated, will not be available via any API calls and you must stored it in a secure place. If you lose the secret key, Edgio cannot recover it and you must generate a new access key (with a new secret key).

Named Parameters Example

JSON
1{
2 "method": "initKeyPair",
3 "id": 1,
4 "params": {
5 "token": "b072c8e4-b2db-4f78-94de-1cd90dc8d881"
6 },
7 "jsonrpc": "2.0"
8}

Positional Parameters Example

Example:
JSON
1{
2 "method": "initKeyPair",
3 "id": 0,
4 "params": [
5 "dc3993e8-6ccb-4a26-b951-b26bfd52d196"
6 ],
7 "jsonrpc": "2.0"
8}

Parameter Descriptions

Parameter NameTypeDescription
tokenstrValid token from a call to login (JSON-RPC interface) or /account/login (HTTP interface). See Log In Using JSON-RPC and Log in Using the HTTP Interface, respectively.

Return Codes

  • 0: success
  • -10001: invalid value for token parameter
  • -10004: unable to generate access key. Contact your Account Manager.
For a list of error codes not specific to initKeyPair, see Global Error Codes.

Response Data

  • access_key: (str) key to use when signing a request
  • code: (int) return code; zero indicates success, non-zero indicates failure
  • secret_key: (str) secret key to use when signing a request
Example:
1{
2 u'access_key': u'8228c1626c8ab9356c6020eede8f69846d8b',
3 u'secret_key': u'86b2b120bf50e635ca84fd91524e5e32e344',
4 u'code': 0
5}
On failure returns a single value set to the appropriate value described in Return Codes.

Python Sample Requests

Generate a key pair:
Python
1>>> api.initKeyPair(token)
2{u'access_key': u'b837132e7ebbea404e5dff8a59358228c1626c856c6069846d8b', u'secret_key': u'86b2b120bf50e6a4fdaeab8be0153818a66ba1710b2a1c9f4',u'code': 0}