Project

General

Profile

Retreive a user ID using REST API given its login

Added by Marc Rosenfeld over 10 years ago

Hi, Sorry if this question is already answered, but I'm new to rails and can't make it work.
according to http://www.redmine.org/projects/redmine/wiki/Rest_Users it's possible to filter users by "name: filter users on their login, firstname, lastname and mail"
I'm trying to retrieve an User id given the user login using the REST API with the exemple presented in http://www.redmine.org/projects/redmine/wiki/Rest_api_with_ruby I'm using the following code to do so:

class User < ActiveResource::Base
self.site ='http://localhost:3000/'
self.user = 'admin'
self.password = 'admin'
end

user = User.find(:name => 'Bob' )

however the user value returned in nil

I also realized, that the following URL do not filter the results.

localhost:3001/users.json?name='bob'

but rather give me back a empty value {"users":[],"total_count":0,"offset":0,"limit":25}.

can someone tell me what is wrong with the code?

PS: I also tried with 'login' instead of "name" but id didn't work neither.


Replies (1)

RE: Retreive a user ID using REST API given its login - Added by Marc Rosenfeld over 10 years ago

Ok, got the problem: the "quotes" cannot be included in the address bar.. --> still need to figure out what is wrong with the ruby code..

    (1-1/1)