What I'd like
I want to be able to reset a users password without emailing them. I also need to do this via REST (it's for a kiosk system).
So I need to:
- Get user with a specific username
- Reset the password of that user
Try as I might, I can't get the user with a username.
The problem
After I've logged in using the admin user via REST I do:
GET on http://mydomain.com/rest/user?name=user
.
According to REST documentation, this should get the user with name user
.
I get a 200 response, but nothing is returned in the body.
What I've Tried
Get node from ID
Once I've logged in as admin, I can do:
GET on http://mydomain.com/rest/user/1
This works, returning the details of user 1 in the response. But I need to search for a user by username.
Different GETs
GET on http://mydomain.com/rest/user/admin
GET on http://mydomain.com/rest/user/account/name/admin
GET on http://mydomain.com/rest/user?account[name]=admin
GET on http://mydomain.com/rest/user?uid=1
GET on http://mydomain.com/rest/user/retrieve?uid=1
GET on http://mydomain.com/rest/user?account[uid]=1
All these fail.
Nodes instead of users
GET on http://mydomain.com/rest/node/1
works, but http://mydomain.com/rest/node?nid=1
gives me a 200 response with nothing in the body.
List of all users
GET on http://mydomain.com/rest/user/
doesn't show a list of all users either. I get a 200 with empty body again.
Further Details
- I'm working with a Drupal 6.22 install.
- I've installed the services module (3.0 RC1) and REST Server (2.0 beta 1).
- I've got the session authentication module installed.
- I've tried the above with the session authentication switched on and with it off.
- I've enabled all node resources and user resources for the REST endpoint I've set up.
- I've tried the above with and without clean URLs and nothing seems to make a difference.
Question
How do I get a user with a specific username? What am I doing wrong?
Update
I've uninstalled then reinstalled Services module, I've done the same with the REST server. I've also rolled back my version of CTools to the latest recommended one. I've added a brand new service in case it was corrupted. Nothing I do works. Frustrating!
Update 2
I've found the problem, but would like a more permanent solution. It turns out it was an error because of table naming. See my current accepted answer.