我看到像https://mastodon.lol/@rosinmas这样的用户,根据文档,API端点应该是:https://mastodon.lol/api/v1/accounts/@rosinmas
但我明白:
{"error":"Record not found"}为什么使用端点不是公共的?
发布于 2022-11-18 22:10:56
您可以使用以下格式调用API,从而获得JSON (不需要身份验证)的帐户信息:
https://[server_name]/api/v1/accounts/[account_id]例如:
https://mastodon.social/api/v1/accounts/1会给你:
{
"id": "1",
"username": "Gargron",
"acct": "Gargron",
"display_name": "Eugen Rochko",
"locked": false,
"bot": false,
"discoverable": true,
"group": false,
"created_at": "2016-03-16T00:00:00.000Z",
"note": "<p>Founder, CEO and lead developer <span class=\"h-card\"><a href=\"https://mastodon.social/@Mastodon\" class=\"u-url mention\">@<span>Mastodon</span></a></span>, Germany.</p>",
"url": "https://mastodon.social/@Gargron",
"avatar": "https://files.mastodon.social/accounts/avatars/000/000/001/original/dc4286ceb8fab734.jpg",
"avatar_static": "https://files.mastodon.social/accounts/avatars/000/000/001/original/dc4286ceb8fab734.jpg",
"header": "https://files.mastodon.social/accounts/headers/000/000/001/original/3b91c9965d00888b.jpeg",
"header_static": "https://files.mastodon.social/accounts/headers/000/000/001/original/3b91c9965d00888b.jpeg",
"followers_count": 222337,
"following_count": 326,
"statuses_count": 72729,
"last_status_at": "2022-11-18",
"noindex": false,
"emojis": [],
"fields": [
{
"name": "Patreon",
"value": "<a href=\"https://www.patreon.com/mastodon\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://www.</span><span class=\"\">patreon.com/mastodon</span><span class=\"invisible\"></span></a>",
"verified_at": null
}
]
}要获得给定username的username,可以传递以下API调用:
https://[server_name]/api/v2/search?q=[username]例如:
https://mastodon.social/api/v2/search?q=Gargron会给你关于服务器上所有Gargron用户名的详细信息.
https://stackoverflow.com/questions/74491788
复制相似问题