GET /api/v3/key_pairs
List all key_pairs

Returns a list of all key_pairs belonging to an account as per the specified criteria. This API is paginated and returns 20 key_pairs by default. A key_pair is uniquely identified by a 'key_pair_key'. This key should be used in all the other API referencing a particular key_pair.

Params

Param name Description
page
optional

Page number of results to be fetched, Default 1


Value: Must be Integer.
per
optional

Number of key_pairs records to be returned in one page, Default 20


Value: Must be Integer.
order_by
optional

Field on which resultant key_pairs should be sorted


Value: Must be a String
order
optional

Order, asc or desc, in which results should be sorted


Value: Must be a String
timestamp_format
optional

Format, “str” or “int”, in which timestamps should be returned, Default “int”


Value: Must be a String
search
optional

Keywords based on which key_pairs should be searched. Currently you can search key_pairs on - key_pair_key


Value: Must be a String
scope
optional

Matching condition if multiple keywords are specified for search. Valid values are “all” or “any”. Default is “all”


Value: Must be a String
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean
field_list
optional

List of fields required in the result.


Value: Must be an array of any type
fields
optional

[Deprecated]Comma separated list of fields required in the result.


Value: Must be a String

Examples

Request - listing all key_pairs without any criteria
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" https://api.datonis.io/api/v3/key_pairs

Response (returns first 20 records)
{
  "total_count": 3,
  "page": 1,
  "key_pairs": [
    {
      "access_key": "t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f",
      "enabled": false,
      "expiry_date": "2015-10-29T18:30:00.000Z",
      "secret_key": "fte4bc52f791eb8513ac71a52ff5463t1bbf2tf9",
      "key_pair_key": "t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f",
      "created_at": 1446017446,
      "updated_at": 1446104758,
      "datonis_role_name": "Agent",
      "datonis_role_key": "1946c4ce5c"
    },
    {
      "access_key": "7d3tdb2a7ff33d6824a6et171b84988aa22993af",
      "enabled": false,
      "expiry_date": "2015-10-14T18:30:00.000Z",
      "secret_key": "f7a45fe4fat5b235269cfd74896detcb1b6cfe7e",
      "key_pair_key": "7d3tdb2a7ff33d6824a6et171b84988aa22993af",
      "created_at": 1446026087,
      "updated_at": 1446102581,
      "datonis_role_name": "abc",
      "datonis_role_key": "dc459a67b3"
    },
    {
      "access_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "enabled": true,
      "expiry_date": "2015-11-05T18:30:00.000Z",
      "secret_key": "2118ca66886e74fe3atbf7e4f3t8554f8t9eft82",
      "key_pair_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "created_at": 1446104372,
      "updated_at": 1446104372,
      "datonis_role_name": "Agent",
      "datonis_role_key": "1946c4ce5c"
    }
  ]
}
Request - listing key_pairs by specifying number of key_pairs to be returned at a time (page size) and specific set to be returned (page)
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"per":"2", "page":"2"}' https://api.datonis.io/api/v3/key_pairs

Response (returns page 2 with 2 key_pairs per page)
{
  "total_count": 3,
  "page": "2",
  "key_pairs": [
    {
      "access_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "enabled": true,
      "expiry_date": "2015-11-05T18:30:00.000Z",
      "secret_key": "2118ca66886e74fe3atbf7e4f3t8554f8t9eft82",
      "key_pair_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "created_at": 1446104372,
      "updated_at": 1446104372,
      "datonis_role_name": "Agent",
      "datonis_role_key": "1946c4ce5c"
    }
  ]
}
Request - listing key_pairs ordered by a field with string formatted timestamps
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"timestamp_format":"str","order_by":"name","order":"desc"}' https://api.datonis.io/api/v3/key_pairs

Response (returns key_pairs in the reverse order of name and timestamps in string format)
{
  "total_count": 5,
  "page": 1,
  "key_pairs": [
    {
      "access_key": "7d3tdb2a7ff33d6824a6et171b84988aa22993af",
      "enabled": false,
      "expiry_date": "2015-10-14T18:30:00.000Z",
      "secret_key": "f7a45fe4fat5b235269cfd74896detcb1b6cfe7e",
      "key_pair_key": "7d3tdb2a7ff33d6824a6et171b84988aa22993af",
      "created_at": "2015/10/28 09:54:47",
      "updated_at": "2015/10/29 07:09:41",
      "datonis_role_name": "abc",
      "datonis_role_key": "dc459a67b3"
    },
    {
      "access_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
      "enabled": false,
      "expiry_date": "2016-09-09T00:00:00.000Z",
      "secret_key": "f2ddt21at5f56128a36t8t9949231acc89481f2f",
      "key_pair_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
      "created_at": "2015/11/02 07:10:42",
      "updated_at": "2015/11/02 07:19:39",
      "datonis_role_name": "Write Only",
      "datonis_role_key": "517d8e4695"
    },
    {
      "access_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "enabled": true,
      "expiry_date": "2015-11-05T18:30:00.000Z",
      "secret_key": "2118ca66886e74fe3atbf7e4f3t8554f8t9eft82",
      "key_pair_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "created_at": "2015/10/29 07:39:32",
      "updated_at": "2015/10/29 07:39:32",
      "datonis_role_name": "Agent",
      "datonis_role_key": "1946c4ce5c"
    },
    {
      "access_key": "t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f",
      "enabled": false,
      "expiry_date": "2015-10-29T18:30:00.000Z",
      "secret_key": "fte4bc52f791eb8513ac71a52ff5463t1bbf2tf9",
     ...
Request - listing key_pair based on keys specified
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"key_pairs":["t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f","d887tb6b876261bd3efae81b63adee585b14tb2c"]}' https://api.datonis.io/api/v3/key_pairs

Response (returns sensors matching the keys specified)
{
  "total_count": 5,
  "page": 1,
  "key_pairs": [
    {
      "access_key": "t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f",
      "enabled": false,
      "expiry_date": "2015-10-29T18:30:00.000Z",
      "secret_key": "fte4bc52f791eb8513ac71a52ff5463t1bbf2tf9",
      "key_pair_key": "t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f",
      "created_at": 1446017446,
      "updated_at": 1446104758,
      "datonis_role_name": "Agent",
      "datonis_role_key": "1946c4ce5c"
    },
    {
      "access_key": "7d3tdb2a7ff33d6824a6et171b84988aa22993af",
      "enabled": false,
      "expiry_date": "2015-10-14T18:30:00.000Z",
      "secret_key": "f7a45fe4fat5b235269cfd74896detcb1b6cfe7e",
      "key_pair_key": "7d3tdb2a7ff33d6824a6et171b84988aa22993af",
      "created_at": 1446026087,
      "updated_at": 1446102581,
      "datonis_role_name": "abc",
      "datonis_role_key": "dc459a67b3"
    },
    {
      "access_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "enabled": true,
      "expiry_date": "2015-11-05T18:30:00.000Z",
      "secret_key": "2118ca66886e74fe3atbf7e4f3t8554f8t9eft82",
      "key_pair_key": "e98f8a4db1dec78tf56668292f576be17521ef3e",
      "created_at": 1446104372,
      "updated_at": 1446104372,
      "datonis_role_name": "Agent",
      "datonis_role_key": "1946c4ce5c"
    },
    {
      "access_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
      "enabled": false,
      "expiry_date": "2016-09-09T00:00:00.000Z",
      "secret_key": "f2ddt21at5f56128a36t8t9949231acc89481f2f",
      "key_pair_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
     ...

GET /api/v3/key_pairs/:key_pair_key
Fetch information for a key_pair

Returns details of the key_pair requested

Params

Param name Description
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean

Examples

Request - get details of the specified key_pair (key_pair_key specified as a part of the url)
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A"  https://api.datonis.io/api/v3/key_pairs/t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f

Response (returns details of the key_pair requested)
{
  "key_pair": {
    "access_key": "t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f",
    "enabled": false,
    "expiry_date": "2015-10-29T18:30:00.000Z",
    "secret_key": "fte4bc52f791eb8513ac71a52ff5463t1bbf2tf9",
    "key_pair_key": "t711t338ttf7b36c4cb27dc9d4acf62ta8c75a7f",
    "created_at": 1446017446,
    "updated_at": 1446104758,
    "datonis_role_name": "Agent",
    "datonis_role_key": "1946c4ce5c"
  }
}

POST /api/v3/key_pairs
Create a key_pair

Creates a key_pair with given parameters

Params

Param name Description
key_pair
required

Object containing information about the key_pair to be created


Value: Must be a Hash
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean

Examples

Request
  curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"key_pair":{"expiry_date":"09/09/2016","datonis_role_key":"517d8e4695"}}' https://api.datonis.io/api/v3/key_pairs

Response (returns details of the key_pair created)
{
  "key_pair": {
    "access_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
    "enabled": true,
    "expiry_date": "2016-09-08T18:30:00.000Z",
    "secret_key": "f2ddt21at5f56128a36t8t9949231acc89481f2f",
    "key_pair_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
    "created_at": 1446448242,
    "updated_at": 1446448242,
    "datonis_role_name": "Write Only",
    "datonis_role_key": "517d8e4695"
  }
}

DELETE /api/v3/key_pairs/:key_pair_key
Delete a key_pair

Deletes the specified key_pair from the system. All associated data is also lost.

Params

Param name Description
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean

Examples

Request
  curl -X DELETE -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A"  https://api.datonis.io/api/v3/key_pairs/abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd

Response
{
}

PUT /api/v3/key_pairs/:key_pair_key
Updates a key_pair

Updates a key_pair with given parameters

Params

Param name Description
key_pair
required

Object containing information about the key_pair to be updated


Value: Must be a Hash
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean

Examples

Request - containing parameters to be modified
  curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"key_pair":{"expiry_date":"09/09/2016", "enabled":"false"}, "datonis_role_key":"517d8e4695"}' https://api.datonis.io/api/v3/key_pairs/abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd

Response (returns details of the key_pair updated)
{
  "key_pair": {
    "access_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
    "enabled": false,
    "expiry_date": "2016-09-09T00:00:00.000Z",
    "secret_key": "f2ddt21at5f56128a36t8t9949231acc89481f2f",
    "key_pair_key": "abec9bb3d2e18c2c1dt4t792b3t73768bf7d68cd",
    "created_at": 1446448242,
    "updated_at": 1446448779,
    "datonis_role_name": "Write Only",
    "datonis_role_key": "517d8e4695"
  }
}