GET /api/v3/datonis_roles
List all datonis_roles

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

Params

Param name Description
page
optional

Page number of results to be fetched, Default 1


Value: Must be Integer.
per
optional

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


Value: Must be Integer.
order_by
optional

Field on which resultant datonis_roles 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 things should be searched. Currently you can search datonis_roles on - datonis_role_key, name


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 datonis_roles without any criteria
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" https://api.datonis.io/api/v3/datonis_roles

Response (returns first 20 records)
{
  "total_count": 5,
  "page": 1,
  "datonis_roles": [
    {
      "abilities": [
        0
      ],
      "account_admin": true,
      "datonis_role_key": "2e46ec4f56",
      "name": "Account Admin",
      "permissions": [
        {
          "class": "all",
          "operation": null,
          "seqno": 0
        }
      ],
      "created_at": 1448282945,
      "updated_at": 1448282945
    },
    {
      "abilities": [
        1,
        11,
        17,
        6
      ],
      "account_admin": false,
      "datonis_role_key": "9c6dcctaec",
      "name": "Read Only",
      "permissions": [
        {
          "class": "thing",
          "operation": "read",
          "seqno": 1
        },
        {
          "class": "sensor",
          "operation": "read",
          "seqno": 1
        },
        {
          "class": "rule",
          "operation": "read",
          "seqno": 6
        },
        {
          "class": "instruction",
          "operation": "read",
          "seqno": 11
        },
        {
          "class": "group",
          "operation": "read",
          "seqno": 17
        }
      ],
      "created_at": 1448282945,
      "updated_at": 1448282945
    },
    {
      "abilities": [
        3
      ],
      "account_admin": false,
      "datonis_role_key": "d5552947a8",
      "name": "Agent",
      "permissions": [
        {
          "class": "thing",
          "operation": "read",
          "seqno": 1
        },
        {
          "class": "thing",
          "operation": "update",
          "seqno": 3
        },
        {
          "class": "sensor",
...
Request - listing datonis_roles by specifying number of datonis_roles 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/datonis_roles

Response (returns page 2 with 2 datonis_roles per page)
{
  "total_count": 5,
  "page": "2",
  "datonis_roles": [
    {
      "abilities": [
        3
      ],
      "account_admin": false,
      "datonis_role_key": "d5552947a8",
      "name": "Agent",
      "permissions": [
        {
          "class": "thing",
          "operation": "read",
          "seqno": 1
        },
        {
          "class": "thing",
          "operation": "update",
          "seqno": 3
        },
        {
          "class": "sensor",
          "operation": "read",
          "seqno": 1
        },
        {
          "class": "sensor",
          "operation": "update",
          "seqno": 3
        }
      ],
      "created_at": 1448282945,
      "updated_at": 1448282945
    },
    {
      "abilities": [
        5
      ],
      "account_admin": false,
      "datonis_role_key": "6t9f5bed7f",
      "name": "Thing_only",
      "permissions": [
        {
          "class": "thing",
          "operation": "read",
          "seqno": 1
        },
        {
          "class": "thing",
          "operation": "create",
          "seqno": 2
        },
        {
          "class": "thing",
          "operation": "update",
          "seqno": 3
        },
        {
          "class": "thing",
          "operation": "delete",
          "seqno": 4
        },
        {
          "class": "thing",
          "operation": "all",
          "seqno": 5
        },
        {
          "class": "sensor",
          "operation": "read",
          "seqno": 1
        },
        {
          "class": "sensor",
          "operation": "create",
          "seqno": 2
        },
      ...

GET /api/v3/datonis_roles/:datonis_role_key
Fetch information for a datonis role

Returns details of the datonis_role 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 datonis_role (datonis_role 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/datonis_roles/d5552947a8

Response (returns details of the datonis_role requested)
{
  "datonis_role": {
    "abilities": [
      3
    ],
    "account_admin": false,
    "datonis_role_key": "d5552947a8",
    "name": "Agent",
    "permissions": [
      {
        "class": "thing",
        "operation": "read",
        "seqno": 1
      },
      {
        "class": "thing",
        "operation": "update",
        "seqno": 3
      },
      {
        "class": "sensor",
        "operation": "read",
        "seqno": 1
      },
      {
        "class": "sensor",
        "operation": "update",
        "seqno": 3
      }
    ],
    "created_at": 1448282945,
    "updated_at": 1448282945
  }
}

POST /api/v3/datonis_roles
Create a datonis_role

Creates a datonis_role with given parameters

Params

Param name Description
datonis_role
required

Object containing information about the datonis_role 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 '{"datonis_role":{"name":"Write Only", "abilities":[3]}}' https://api.datonis.io/api/v3/datonis_roles

Response (returns details of the datonis_role created)
{
  "datonis_role": {
    "abilities": [
      3
    ],
    "account_admin": false,
    "datonis_role_key": "517d8e4695",
    "name": "Write Only",
    "permissions": [
      {
        "class": "datonis_role",
        "operation": "read",
        "seqno": 1
      },
      {
        "class": "datonis_role",
        "operation": "update",
        "seqno": 3
      }
    ]
  }
}

DELETE /api/v3/datonis_roles/:datonis_role_key
Delete a datonis_role

Deletes the specified datonis_role 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/datonis_roles/517d8e4695

Response
{
}

PUT /api/v3/datonis_roles/:datonis_role_key
Updates a datonis_role

Updates a datonis_role with given parameters

Params

Param name Description
datonis_role
required

Object containing information about the datonis_role 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 '{"datonis_role":{"abilities":[5],"name":"Write Only"}}}' https://api.datonis.io/api/v3/datonis_roles/517d8e4695

Response (returns details of the datonis_role updated)
{
  "datonis_role": {
    "abilities": [
      5
    ],
    "account_admin": false,
    "datonis_role_key": "517d8e4695",
    "name": "Write Only",
    "permissions": [
      {
        "class": "datonis_role",
        "operation": "read",
        "seqno": 1
      },
      {
        "class": "datonis_role",
        "operation": "create",
        "seqno": 2
      },
      {
        "class": "datonis_role",
        "operation": "update",
        "seqno": 3
      },
      {
        "class": "datonis_role",
        "operation": "delete",
        "seqno": 4
      },
      {
        "class": "datonis_role",
        "operation": "all",
        "seqno": 5
      }
    ]
  }
}