API oddities with calling GET /users

api

#1

It seems to be there are a few things it would help to understand better when calling GET /users and referencing https://help.zscaler.com/zia/api

Currently, testing in ZscalerBeta.

  • Do not appear to be able to retrieve any users who are admin users and have the Super Admin role (neither with or without a parameter) which does not occur in the WebUI under User Management
  • Search by name looks in both “name” and “email” and searches as ‘contains’ as opposed to ‘starts with’ like group/department (just like in WebUI), but isn’t documented so clearly
  • A parameter search with an incorrect parameter name (such as ‘email’) is ignored instead of throwing an error (this may or may not be an issue, but since I was trying to figure out whether ‘email’ worked or not, it returned odd results by returning everything)

These three factors combined gave me quite the runaround when trying to scope out using the API call for my project. Also, the Super Admin thing is kind of inconvenient since i have no way of retrieving their user data without knowing the ID ahead of time as a /users/…ID… does work for them (but i had to get it through Dev Tools on the WebUI)


(Jeff Ostermiller) #2

Andrew
When I do a get users on zscloud.net I see the admin user. Is this just a beta cloud issue?
snippet from the script
def GetUsers():
conn.request(“GET”, “/api/v1/users?page=1&pageSize=100”, headers=headers)
res = conn.getresponse()
data = res.read()
PrettyPrint(json.loads(data.decode()))
Pause()

output from the API

[
{
“adminUser”: true,
“department”: {
“id”: 5455052,
“name”: “Service Admin”
},
“email”: "admin@jostermiller.zscloud.net",
“groups”: [
{
“id”: 5455051,
“name”: “Service Admin”
}
],
“id”: 5455053,
“name”: “DEFAULT ADMIN”
},
{
“adminUser”: true,
“department”: {
“id”: 5455052,
“name”: “Service Admin”
},
“email”: "auditor@jostermiller.zscloud.net",
“groups”: [
{
“id”: 5455051,
“name”: “Service Admin”
}
],
“id”: 6222295,
“name”: “auditor”
},
{
“adminUser”: false,
“email”: "jostermiller@jostermiller.zscloud.net",
“groups”: [
{
“id”: 6451803,
“name”: “Everyone”
}
],
“id”: 6451804,
“name”: “Jeff Ostermiller”
},
{
“adminUser”: false,
“email”: "marilyn@jostermiller.zscloud.net",
“groups”: [
{
“id”: 6451803,
“name”: “Everyone”
},
{
“id”: 5645584,
“name”: “Family”
}
],
“id”: 5645604,
“name”: “Marilyn Ostermiller”
},
{
“adminUser”: false,
“comments”: “family”,
“email”: "sophia@jostermiller.zscloud.net",
“groups”: [
{
“id”: 6451803,
“name”: “Everyone”
}
],
“id”: 6205339,
“name”: “sophia ostermiller”
},
{
“adminUser”: false,
“email”: "voula@jostermiller.zscloud.net",
“groups”: [
{
“id”: 6451803,
“name”: “Everyone”
}
],
“id”: 5645599,
“name”: “voula ostermiller”
}