How to return list of all (preferably non-app) users using rest/api/search/user endpoint?

Currently I’m using following URL to get a list of all users (to be displayed in user picker):

/rest/api/search?limit=20&cql=type=user

The problem is that this way of searching users has been deprecated. According to suggested approach, I’m looking at how to use /rest/api/search/user endpoint instead. This is URL of request I’m trying to do instead:

/rest/api/search/user?limit=20

The problem is I’m getting cql query parameter is required validation error and I haven’t found a way how to this make this URL valid and still get all users. Probably I’m missing something obvious but I don’t know what exactly. Another question is how to exclude app users from search results?

1 Like

Hi @LukaszWiatrak,

Maybe I don’t quite understand your question, but have you tried /rest/api/search/user?limit=20&cql=type=user?

Regards,
Dugald

1 Like

To search for a user by name, I use /rest/api/search?cql=user.fullname ~"{search term}"

Thanks @dmorrow looks like this is exactly this obvious thing I was missing! I assumed that search/user endpoint should not need additional cql=type=user cql filtering and haven’t tested it this parameter.

Another part of question is excluding app users from search results. Is it possible to achieve? I see that this endpoint returns json containing accountType property but it’s blank (and probably not supported in cql):

"results": [
   {
      "user": {
        "type": "known",
        "accountId": "somevalue",
        "accountType": "",
        ...
   }
]
1 Like

Hi, did you achieve it ?

We are facing a similar issue, cql=type=user seems to not work because we are receiving different types of user, and also the accountType is blank.

Thanks,

No, unfortunately not. It looks like it’s either a bug or an API limitation

@dmorrow Can you help us with this please ?

Yes, it looks like the accountType field is present, but always empty. I’ve created https://jira.atlassian.com/browse/CONFCLOUD-70582 for this.

3 Likes

Thank you Dugald, we will track the bug !