Context
- Plone 5.2 with email login enabled
- Python3
Problem
(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:
requests.get('http://nohost/plone/@users/noam', 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": "noam.chomsky@example.com",
"fullname": "Noam Avram Chomsky",
"home_page": "web.mit.edu/chomsky",
"id": "noam",
"location": "Cambridge, MA",
"portrait": null,
"roles": [
"Member"
],
"username": "noam"
}
(Edit: Sorry, I wrongly identified username
and user id id
. Corrected below.)
and, among others, we see the the user id "noam" in the username
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 user id username
id
of a user, just knowing his email
. Do you know how to proceed?