REST API for getting User by username/ emailId


#1

I have been through metabase REST API. For retrieving a User we have to use below API:
GET /api/user/:id
where ‘id’ is metabase generated numeric unique Id.

Is there any API where we can retrieve user by EmailId/UserId
something like:
GET /api/user/:username


#2

Any reason you can’t just use GET /api/user/ to get a list of all users?


#3

I want to check if particular email Id is already registered on metabase.
Retrieving the list of all the users each time to check that doesn’t seem a good option.

To avoid retrieving of the data each time:
I will have to maintain a copy of all Users(which I will have to keep updating).
Or
I can query directly to metabase metadb (I am using PostgreSQL as external DB) table ‘core_user’.
(I am not sure if interacting directly with metabase meta db is a good idea.)

So if we have an API like GET /api/user/:username. It would be helpful. Definitely, will save a lot of work.


#4

I can see that as a problem if you have 1000s of users, but other than that, just write a helper class.
Querying the metadb is fine provided the database doesn’t change across versions. I’m not sure of the page size, but I’d expect all your users to fit in one page, so still pulling everything from the DB each time.


#5

Alright. I have no constraints on number of users. So I would go with querying the metadb.
Thanks.