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.
| 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 |
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":...