Skip to content

Question: how to fetch information about a user #821

Answered by neet
pietervdvn asked this question in Q&A
Discussion options

You must be logged in to vote

According to the Mastodon doc:

:id
REQUIRED String. The ID of the Account in the database.
https://docs.joinmastodon.org/methods/accounts/#get

Therefore the id parameter is the ID of the account which is different from a username. It consists of 18 digits of integer and should look like 109385598812984542. The value is different in each instance because each instance has its own database.

If you don't know the ID of the target account or don't want to hard-code the ID, you might be able to use v1.accounts.lookup for getting a profile from the username. c.f.

const acct = await masto.v1.accounts.lookup({
  acct: '@[email protected]',
});
console.log(`ID: ${acct.id}`);

I hope this h…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pietervdvn
Comment options

Answer selected by pietervdvn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #820 on January 17, 2023 15:16.