GET /api/v3/users
List all users

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

Params

Param name Description
page
optional

Page number of results to be fetched, Default 1


Value: Must be Integer.
per
optional

Number of users to be returned in one page, Default 20


Value: Must be Integer.
order_by
optional

Field on which users 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
search
optional

Keywords based on which users should be searched. Currently you can search users on - user_key, name, tags or user_defined_properties


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
timestamp_format
optional

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


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
is_oem
optional

Return users of child account if is_oem flag is true.


Value: Must be one of: <code>true</code>, <code>false</code>, <code>true</code>, <code>false</code>.
child_organisation_key
optional

Organisation key of child account. Required field if is_oem is present.


Value: Must be a String

Examples

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

Response (returns first 20 records)
{
  "total_count": 3,
  "page": 1,
  "users": [
    {
      "address": "Baner",
      "city": "Pune",
      "confirmed_at": "2015-11-04T09:08:01.247Z",
      "country": "India",
      "email": "bill@acme.com",
      "first_name": "Bill",
      "last_name": "Doe",
      "phone": "9803123547",
      "role": "admin",
      "time_zone": "Mumbai",
      "user_key": "1e5228ttd8",
      "created_at": 1446627978,
      "updated_at": 1448445578,
      "role_name": "Account Admin",
      "role_key": "67e37d7bat"
    },
    {
      "address": "Bandra Mumbai",
      "city": "Mumbai",
      "confirmed_at": "2015-11-25T09:32:58.950Z",
      "country": "India",
      "email": "jack@yahoo.com",
      "first_name": "Jack",
      "last_name": "Timberly",
...
Request - listing users by specifying number of users 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/users

Response (returns page 2 with 2 users per page)
{
  "total_count": 3,
  "page": "2",
  "users": [
    {
      "address": "Andheri Mumbai",
      "city": "Mumbai",
      "confirmed_at": "2015-11-25T09:40:35.295Z",
      "country": "India",
      "email": "mike@gmail.com",
      "first_name": "Mike",
      "last_name": "Potter",
      "phone": "9981563298",
      "role": "normal",
      "time_zone": "Mumbai",
      "user_key": "3ee266547t",
      "created_at": 1448444349,
      "updated_at": 1448444435,
      "role_name": "Read Only",
      "role_key": "411a45tdc7"
    }
  ]
}
Request - listing users ordered by a field with string formatted timestamps
  curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"timestamp_format":"str","order_by":"first_name","order":"desc"}' https://api.datonis.io/api/v3/users

Response (returns users in the reverse order of their name and timestamps in string format)
{
  "total_count": 3,
  "page": 1,
  "users": [
    {
      "address": "Andheri Mumbai",
      "city": "Mumbai",
      "confirmed_at": "2015-11-25T09:40:35.295Z",
      "country": "India",
      "email": "mike@gmail.com",
      "first_name": "Mike",
      "last_name": "Potter",
      "phone": "9981563298",
      "role": "normal",
      "time_zone": "Mumbai",
      "user_key": "3ee266547t",
      "created_at": "2015/11/25 09:39:09",
      "updated_at": "2015/11/25 09:40:35",
      "role_name": "Read Only",
      "role_key": "411a45tdc7"
    },
    {
      "address": "Baner",
      "city": "Pune",
      "confirmed_at": "2015-11-04T09:08:01.247Z",
      "country": "India",
      "email": "bill@acme.com",
      "first_name": "Bill",
     ...
Request - listing users based on some search criteria with all keywords matching
  curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"search":"Jack Mike"}' https://api.datonis.io/api/v3/users

Response (returns users containing both keywords 'Jack' as well as 'Mike')
{
  "total_count": 0,
  "page": 1,
  "users": [

  ]
}
Request - listing users based on some search criteria with any of the keywords matching
  curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:olezAZXGQn9MutnfNerKDQ" -d '{"search":"Jack Mike","scope":"any"}' https://api.datonis.io/api/v3/users

Response (returns users containing either of the keywords 'Jack' or 'Mike')
{
  "total_count": 2,
  "page": 1,
  "users": [
    {
      "address": "Bandra Mumbai",
      "city": "Mumbai",
      "confirmed_at": "2015-11-25T09:32:58.950Z",
      "country": "India",
      "email": "jack@yahoo.com",
      "first_name": "Jack",
      "last_name": "Timberly",
      "phone": "9824678234",
      "role": "admin",
      "time_zone": "Mumbai",
      "user_key": "93et87a5a5",
      "created_at": 1448443772,
      "updated_at": 1448443978,
      "role_name": "Account Admin",
      "role_key": "67e37d7bat"
    },
    {
      "address": "Andheri Mumbai",
      "city": "Mumbai",
      "confirmed_at": "2015-11-25T09:40:35.295Z",
      "country": "India",
      "email": "mike@gmail.com",
      "first_name": "Mike",
      "last_name": "Potter",
      "phone": "9981563298",
      "role": "normal",
      "time_zone": "Mumbai",
      "user_key": "3ee266547t",
      "created_at":...

GET /api/v3/users/:user_key
Fetch information for a role

Returns details of the user requested

Params

Param name Description
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean
is_oem
optional

Show user of child account if is_oem flag is true.


Value: Must be one of: <code>true</code>, <code>false</code>, <code>true</code>, <code>false</code>.

Examples

Request - get details of the specified user (user 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/users/1e5228ttd8

Response (returns details of the user requested)
{
  "user": {
    "address": "Baner",
    "city": "Pune",
    "confirmed_at": "2015-11-04T09:08:01.247Z",
    "country": "India",
    "email": "bill@acme.com",
    "first_name": "bill",
    "last_name": "Doe",
    "phone": "9803123547",
    "role": "admin",
    "time_zone": "Mumbai",
    "user_key": "1e5228ttd8",
    "created_at": 1446627978,
    "updated_at": 1448444844,
    "role_name": "Account Admin",
    "role_key": "67e37d7bat"
  }
}

PUT /api/v3/users/:user_key
Updates a user

Updates a user with given parameters

Params

Param name Description
datonis_role_key
optional

Key of datonis role to be assigned to user. This field is required


Value: Must be a String
user
required

Map containing details of the user 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
is_oem
optional

Update user in child account by oem user if is_oem flag is true.


Value: Must be a Boolean
child_organisation_key
optional

Organisation key of child account where oem user wants to update user. Required field if is_oem is present.


Value: Must be a String

Examples

Request - containing parameters to be modified
  curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:WtUFnj8pvSxVnH9e_xkq7A" -d '{"user":{"address":"Baner","city":"Pune","country":"India","first_name":"bill","last_name":"Doe","phone":"9803123547","role":"admin"},"role_key":"67e37d7bat"}' https://api.datonis.io/api/v3/users/1e5228ttd8

Response (returns details of the user updated)
{
  "user": {
    "address": "Baner",
    "city": "Pune",
    "confirmed_at": "2015-11-04T09:08:01.247Z",
    "country": "India",
    "email": "bill@acme.com",
    "first_name": "bill",
    "last_name": "Doe",
    "phone": "9803123547",
    "role": "admin",
    "time_zone": "Mumbai",
    "user_key": "1e5228ttd8",
    "created_at": 1446627978,
    "updated_at": 1448444844,
    "role_name": "Account Admin",
    "role_key": "67e37d7bat"
  }
}

DELETE /api/v3/users/:user_key
Delete a user

Deletes the specified user 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
is_oem
optional

Delete user in child account by oem user if is_oem flag is true.


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/users/93et87a5a5

Response
{
}

PUT /api/v3/users/:user_key
Change user password

Change the users password.

Params

Param name Description
user
required

Map containing users password value 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
is_oem
optional

OEM Admin user can change password of user in child account by oem user if is_oem flag is true.


Value: Must be a Boolean

Examples

Request
  curl -X PUT -H "Content-Type:application/json" -H "X-Auth-Token:BmHmv9IJey5l_LK0N2Ciaw" -d '{"user":{"password":"jack123456"}}' https://api.datonis.io/api/v3/users/1e5228ttd8/change_password

Response
{
  "user": {
    "address": "Baner",
    "city": "Pune",
    "confirmed_at": "2015-11-04T09:08:01.247Z",
    "country": "India",
    "email": "bill@acme.com",
    "first_name": "bill",
    "last_name": "Doe",
    "phone": "9803123547",
    "role": "admin",
    "time_zone": "Mumbai",
    "user_key": "1e5228ttd8",
    "created_at": 1446627978,
    "updated_at": 1448445499,
    "role_name": "Account Admin",
    "role_key": "67e37d7bat"
  }
}

POST /api/v3/users/:user_key
Invite user

Invite new user

Params

Param name Description
datonis_role_key
required

Key of datonis role to be assigned to user


Value: Must be a String
user
required

Map containing details of the user to be invited


Value: Must be a Hash
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean
is_oem
optional

Invite user in child account by oem user if is_oem flag is true.


Value: Must be a Boolean
child_organisation_key
optional

Organisation key of child account where oem user wants to invite user. Required field if is_oem is present.


Value: Must be a String

Examples

Request
  curl -X POST -H "Content-Type:application/json" -H "X-Auth-Token:D--gyhhE-FPH5LXL3osGAQ" -d '{"user":{"first_name":"Jack", "last_name":"Timberly", "email":"jack@yahoo.com"},"role_key":"67e37d7bat"}' https://api.datonis.io/api/v3/users/invite

Response
Invitation sent successfully