Select to view content in your preferred language

Users search returns a response inconsistent with the docs

173
0
02-21-2025 11:20 AM
Labels (1)
MikeDavlantes
Occasional Contributor

The docs for /sharing/rest/portals/{portal_id}/users/search indicate that we should expect an array of user objects in the response.

 

Mike (with a "Data Editor" role), querying for Shawn (profile set to be visible to the organization):

GET /sharing/rest/portals/{portal_id}/users/search?q=shaw
```python
{
    "total": 1,
    "start": 1,
    "num": 10,
    "nextStart": -1,
    "results": [
        {
            "username": "shawn_cc",
            "udn": None,
            "id": "880812e13f6dfg4f82d2395553a0ad8b",
            "fullName": "Shawn Lastname",
            "firstName": "Shawn",
            "lastName": "Lastname",
            "description": "Software Engineer
https://chrono.cards",
            "tags": [],
            "culture": "en-US",
            "cultureFormat": None,
            "region": None,
            "units": None,
            "thumbnail": "blob.png",
            "access": "org",
            "created": 1596658728000,
            "modified": 1721761958000,
            "provider": None,
        }
    ],
}
```

Fields listed in the documentation are not present (particularly email and role). One might think this is an access/security issue given the lower role. However, the same accounts involved in a similar request return email and role:

GET /sharing/rest/portals/{portal_id}/users/?username=shawn_cc
```python
{
    "total": 1,
    "start": 1,
    "num": 10,
    "nextStart": -1,
    "users": [
        {
            "username": "shawn_cc",
            "udn": None,
            "id": "880812e13f6dfg4f82d2395553a0ad8b",
            "fullName": "Shawn Lastname",
            "categories": [],
            "emailStatus": "verified",
            "emailStatusDate": 1713454192000,
            "firstName": "Shawn",
            "lastName": "Lastname",
            "preferredView": None,
            "description": "Software Engineer
https://chrono.cards",
            "email": "shawn.lastname@chrono.cards",
            "userType": "arcgisonly",
            "idpUsername": None,
            "favGroupId": "2a57b412c0044fcab3506fd78ec22dc9",
            "lastLogin": 1739464220000,
            "mfaEnabled": False,
            "mfaEnforcementExempt": False,
            "storageUsage": 540156,
            "storageQuota": 2199023255552,
            "orgId": "Q9ffpH9MNoz7efXP",
            "role": "org_admin",
            "level": "2",
            "userLicenseTypeId": "creatorUT",
            "disabled": False,
            "tags": [],
            "culture": "en-US",
            "cultureFormat": "us",
            "region": None,
            "units": None,
            "thumbnail": "blob.png",
            "access": "org",
            "created": 1596658728000,
            "modified": 1721761958000,
            "provider": "arcgis",
        }
    ],
}
```

If you promote Mike to an admin, both responses return essentially the same fields.

  1. If this behavior is intentional, the documentation should reflect it. Maybe I missed it somewhere?
  2. If email/role are being omitted from the first response due to role/access, should they not also be omitted from the second response?

I can't tell if this is a documentation bug, or a response bug, or what, but the behavior is confusing. If a data editor user is allowed access to email/role, why is it not included in the first response?

 

0 Kudos
0 Replies