How to fetch user role base on identifier with REST API?

What is the endpoint for fetching a user along with their roles based on an identifier?
When I use the URL:
http://localhost:1338/api/users/1?populate=role
I get the user associated with ID 1 and the first role assigned to them. However, I would like to retrieve the user based on an identifier (like a username or email) instead of an ID, and obtain all the roles associated with that user. Ideally, I am looking for a URL structure similar to:
http://localhost:1338/api/users/?populate=roles

In Strapi a user can only have one role.

1 Like

Check this

GET /api/users?filters[username][$eq]=John