How to get the account id for Gerrit 3.2.6

536 views
Skip to first unread message

shang...@gmail.com

unread,
May 20, 2021, 8:46:19 AM5/20/21
to Repo and Gerrit Discussion
Hi All,

I don't know how to get the account id of a user since update to 3.2.6 as  I have migrated reviewDB to noteDB, I tried to use admin-console plugin, but I encoutered the internal error issue.

Thanks

Matthias Sohn

unread,
May 20, 2021, 11:56:14 AM5/20/21
to shang...@gmail.com, Repo and Gerrit Discussion
On Thu, May 20, 2021 at 2:46 PM shang...@gmail.com <shang...@gmail.com> wrote:
Hi All,

I don't know how to get the account id of a user since update to 3.2.6 as  I have migrated reviewDB to noteDB, I tried to use admin-console plugin, but I encoutered the internal error issue.

The storage format is explained here [1].

You can use the REST API to query for the accountId, e.g. using the username or email of the user you are looking for [2]:
https://gerrithost/a/accounts/?q=username:johndoe
https://gerrithost/a/accounts/?q=email:joh...@example.foo

this will return the accountId, e.g.:

[{"_account_id": 1024738}]

with that you can use all the other account REST API endpoints [3] to get more details.


-Matthias

shang...@gmail.com

unread,
May 20, 2021, 12:47:23 PM5/20/21
to Repo and Gerrit Discussion
Thanks a lot, Matthias, I just found that :)

Yingchun Li

unread,
Mar 2, 2022, 11:01:12 PM3/2/22
to Repo and Gerrit Discussion
On Thursday, May 20, 2021 at 11:56:14 PM UTC+8 Matthias Sohn wrote:
On Thu, May 20, 2021 at 2:46 PM shang...@gmail.com <shang...@gmail.com> wrote:
Hi All,

I don't know how to get the account id of a user since update to 3.2.6 as  I have migrated reviewDB to noteDB, I tried to use admin-console plugin, but I encoutered the internal error issue.

The storage format is explained here [1].

You can use the REST API to query for the accountId, e.g. using the username or email of the user you are looking for [2]:
https://gerrithost/a/accounts/?q=username:johndoe
https://gerrithost/a/accounts/?q=email:joh...@example.foo
It works, but not so convinent, why not use an administrator command?
Reply all
Reply to author
Forward
0 new messages