API search for role type


  • Used Zammad version: 3.6.x
  • Used Zammad installation source: (source, package, …) package
  • Operating system: Debian 10
  • Browser + version: FF current

Expected behavior:

  • return users which have at least a specific role (i.e. Agent)

Actual behavior:

  • cURL returns empty result

Steps to reproduce the behavior:

  • execute the curl statement

Hi community,

I’d like to use a curl statement which returns the users which have i.e. the “Agent” role.

I tried the following:

curl -H "Authorization: Token token=$TOKEN" -H "Content-Type: application/json" 'https://zammad.mydomain.tld/api/v1/users/search?query=roles:Agent&expand=true' | jq

A search with query=id:5 for example works as expected.

Can someone point my to the right way? Thx in advance

Kind regards

You’re mixing objects, references and other parts quite heavingly.
First of all, the way you try to reach your goal does not work.

Roles technically are just a reference for users, they don’t belong to the user object which is why you can’t look it up in the way you’re trying to.

The only way you can search for users with a specific role is by ID.
In my instance Admin roles has ID 1 (may differ for you).

So to get all admin users I’d use this search phrase: role_ids: 1

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.