Unable to use api/v2/users/search to search against ID field

Hi all,

I'm working on a few quick and easy functions to get information about PureCloud - Currently i'm working on returning the StationID and User who's logged into a given Station Name.

I'm attempting to use the Users/Search api call to search for a user (as a GET on api/v2/stations only returns UserID of the associated user) but i'm finding issues when performing the search.

I'm able use the following query and the results return my own user:

{
    "returnFields": ["id", "name", "email"],
    "query": [{
        "value": "Joshua Hopkins",
        "fields": ["name"],
        "type": "EXACT"
    }]
}

However, when attempting almost the exact same query, I get no results returned:

{
    "returnFields": ["id", "name", "email"],
    "query": [{
        "value": "d54f1a9e-8335-47e8-8e7b-4da85d93013d",
        "fields": ["id"],
        "type": "EXACT"
    }]
}

Any ideas for how I can search for a particular user based on their ID and return various details?

Thanks, Josh.

The correct way to retrieve a user by ID is to use GET /api/v2/users/{userId}. This is a much more efficient request since it is doing a direct lookup, not a search. If you need to get multiple users, use GET /api/v2/users and specify a comma separated list of user IDs in the id query string property (e.g. ?id=9ed7d9f6-0c59-4360-ac54-40dd35eb9c2f,8c35c7da-440c-47b9-b9e3-658e5574a086).

The reason you don't get any results for the second query is a bug. I've opened SRCH-1261 for this. If you must search by user ID, use the field guid instead of id, but again, searching for IDs is a poor practice.