API 文档API 端点
用户资料
获取Twitter用户个人资料信息的API
用户资料
获取Twitter用户的个人资料信息。
请求
URL: /api/twitter/user-profile
方法: GET 或 POST
请求参数:
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| screenName | string | 是 | 用户的屏幕名称/用户名 |
响应
成功响应会返回用户的详细资料信息,包括用户名、简介、关注者数量、头像URL等。
示例
请求示例
# GET 请求
curl --request GET \
--url 'https://www.aidir.fun/api/twitter/user-profile?screenName=elonmusk' \
--header 'X-API-Key: <api-key>'
# POST 请求
curl --request POST \
--url 'https://www.aidir.fun/api/twitter/user-profile' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"screenName": "elonmusk"
}'响应示例
{
"data": {
"type": "user",
"userName": "Elon Musk",
"url": "https://twitter.com/elonmusk",
"id": "44196397",
"name": "Elon Musk",
"isBlueVerified": true,
"profilePicture": "https://pbs.twimg.com/profile_images/1234567890/avatar.jpg",
"coverPicture": "https://pbs.twimg.com/profile_banners/44196397/1234567890/1500x500",
"description": "CEO of companies",
"location": "A Shortcut to the Stars",
"followers": 123456789,
"following": 123,
"canDm": true,
"createdAt": "2009-06-02T20:12:29.000Z",
"favouritesCount": 12345,
"hasCustomTimelines": true,
"isTranslator": false,
"mediaCount": 1234,
"statusesCount": 12345
}
}错误响应
| 状态码 | 描述 |
|---|---|
| 400 | 请求参数错误,例如缺少必需的 screenName 参数 |
| 401 | 认证失败,API密钥无效或缺失 |
| 404 | 用户不存在 |
| 500 | 服务器内部错误 |
MkSaaS文档