Project

General

Profile

Filter users when calling REST API

Added by Mayama Takeshi about 7 years ago

Hi,
I am trying to find a specific user by email like this:
curl -x '' -u TOKEN 'http://SERVER_IP/users.json?mail='
But i get all users.
I can see this kind of filtering works for issues.json.
Can someone confirm it is not really possible to filter users when using the REST API?


Replies (4)

RE: Filter users when calling REST API - Added by Tatsuya Saito about 7 years ago

Please try like following:

curl -x '' -u TOKEN 'http://SERVER_IP/users.json?name=admin@somenet.foo' 

See Rest_Users

RE: Filter users when calling REST API - Added by Saiyam Chawla 4 months ago

Hi

I am trying this

curl --location 'https://SERVER_IP/users.json?name=' \
--header 'X-Redmine-API-Key: c11xxxxxxxxxxxx2xxxxxxxxxxxbcbxxxx1f' \
--header 'Content-Type: application/json'

But it is still giving me all users data.

The optional filter is not working.

Can you please help us out with this?

RE: Filter users when calling REST API - Added by Mayama Takeshi 3 months ago

I tried now on my Redmine 5.1.3.stable

and all these worked:

curl 'http://SERVER/users.json?name=mata@gmail.com' -H 'X-Redmine-API-Key: KEY'

curl 'http://SERVER/users.json?mail=mata@gmail.com' -H 'X-Redmine-API-Key: KEY'

curl 'http://SERVER/users.json?login=Admin' -H 'X-Redmine-API-Key: KEY'

Maybe you are running a very old redmine version.

    (1-4/4)