Getting a user id through REST API: vicious circle, or how to get this user id just from his email?


  • Plone 5.2 with email login enabled
  • Python3


(Note that the current question is close to [RESOLVED] Updating a group by adding a user through REST API: doesn't work with his email as user_id even if email login is enabled

Reading a User through Plone RESTful API says:

To retrieve all details for a particular user, send a GET request to the /@users endpoint and append the user id to the URL:

headers={ 'Accept': 'application/json', }, auth=('admin', 'secret'))

What the server will respond is:

HTTP/1.1 200 OK
Content-Type: application/json

  "@id": "http://localhost:55001/plone/@users/noam", 
  "description": "Professor of Linguistics", 
  "email": "", 
  "fullname": "Noam Avram Chomsky", 
  "home_page": "", 
  "id": "noam", 
  "location": "Cambridge, MA", 
  "portrait": null, 
  "roles": [
  "username": "noam"

(Edit: Sorry, I wrongly identified username and user id id. Corrected below.)

and, among others, we see the username the user id "noam" in the id field. But it is a kind of a vicious circle, since this user id was needed (we had to append it to the URL) to get this user id.

This remark comes from what I'd like to do: to get through REST API the username user id id of a user, just knowing his email. Do you know how to proceed?

1 Like supports "some basic filtering" Try and see if you can search using the email address

I already seen this feature but AFAICS this filtering only applies to usernames:

The server will respond with a list the filtered users in the portal with username starts with the query.

Edit: I confirm that filtering on (part of) the email address gives an empty list if it is not contained in any of the usernames.

and ?

1 Like

Good catch, thanks!

IMHO, still quite strange that "To retrieve all details for a particular user", one needs to "send a GET request to the /@users endpoint and append the user id to the URL" : we are bitten if we precisely are interested in this user id detail. It would be nice if we could retrieve all details for a particular user from the other fields, at least the email one which uniquely identifies a user and is the key one in case of email login enabled.

@espenmn, this tip could be useful.