Feature #32090
closed
REST API: users: add support for status=*
Added by Martin von Wittich almost 5 years ago.
Updated 7 months ago.
Description
Currently, the /users.:format REST API will default to status=1 (active), that is, when you attempt to search for a certain user (redmine-admin.auth
contains an API token of an administrator in the format -u TOKEN:x
):
curl -H 'Content-Type: application/json' \
-G -K redmine-admin.auth \
'https://redmine.example.com/users.json?name=firstname.lastname'
it will only return the requested account when the account is active. This means that I have to make two request for status=1
and status=3
to find a user when I don't know if the account is locked or not :(
I would have suspected that status=*
would return all kinds of users, similarly to how it works for Rest Issues with status_id=*
, but this is apparently not the case.
You can get users with any status by adding 'status=' parameter.
curl --user admin:password 'http://redmine.example.com/users.json?status='
- Status changed from New to Resolved
Go MAEDA wrote:
You can get users with any status by adding 'status=' parameter.
That does exactly what I wanted, thanks! I've updated the wiki accordingly.
Hm, there is one other issue I've stumbled over - users.json?name=foobar&status=
won't return the status of the matched users. I either have to query the statuses separately (users.json?name=foobar&status=1
and so on) so I know that all matched users have the status I just queried, or I have to query each returned user separately with users/<id>.json
to get the user's status. Is that intentional, or could a status
field be added to users.:format
?
This is so extremly not obvious.
Is it possible to update documentation to point to that feature?
- Is duplicate of Defect #40099: User api filtering by status=* broke on upgrade from 5.0 to 5.1 added
- Status changed from Resolved to Closed
- Resolution set to Duplicate
The behaviour changed as follow:
- Redmine <= 5.0.*: you can use
status=
to get all users from API
- Redmine 5.1.0 and 5.1.1: you can only use
users.json?f[]=status_id&op[status_id]==&v[status_id][]=1&v[status_id][]=2&v[status_id][]=3
to get all users because of #40099.
- Redmine >= 5.1.2: you can use
status=
which is now deprecated in favour of status=*
or the long syntax
- Redmine 6.0: you can only use
status=*
or the long syntax
Also available in: Atom
PDF