Tài liệu API Hop
Lấy người dùng theo ID
>-
https://api.apihop.ai/v1/twitter/users/{id}Khi đã có ID người dùng chuẩn hóa, truy vấn trực tiếp tài nguyên này thay vì phân giải tên người dùng lần nữa.
GET https://api.apihop.ai/v1/twitter/users/{id}Xác thực
Mọi điểm cuối API Twitter cần xác thực Bearer Token.
Authorization: Bearer YOUR_API_KEYTham số đường dẫn
idstringbắt buộcID người dùng Twitter, như 44196397.
Tham số truy vấn
user.fieldsstringTrường người dùng phân cách dấu phẩy, như verified,public_metrics,profile_image_url.
Ví dụ yêu cầu
curl --request GET \
"$API_BASE_URL/v1/twitter/users/44196397?user.fields=verified,public_metrics,profile_image_url" \
--header "Authorization: Bearer YOUR_API_KEY"Phản hồi
dataobjectbắt buộcĐối tượng người dùng chuẩn hóa.
Các trường data
idstringbắt buộcMã định danh người dùng duy nhất.
namestringbắt buộcTên hiển thị.
usernamestringbắt buộcTên người dùng không có @.
created_atstringDấu thời gian ISO 8601, trả khi yêu cầu user.fields=created_at.
descriptionstringTiểu sử người dùng.
entitiesobjectThực thể hồ sơ, như mô tả URL và liên kết.
locationstringVị trí trong hồ sơ người dùng.
pinned_tweet_idstringID bài đăng ghim.
profile_banner_urlstringURL ảnh bìa hồ sơ.
profile_image_urlstringURL ảnh hồ sơ.
protectedbooleanTài khoản có được bảo vệ không.
public_metricsobjectChỉ số người dùng công khai.
Các trường public_metrics
followers_countintegerSố người theo dõi.
following_countintegerSố tài khoản đang theo dõi.
tweet_countintegerTổng số bài đăng.
listed_countintegerSố danh sách chứa người dùng. Có thể vắng mặt khi nguồn dữ liệu không cung cấp.
urlstringURL website trong hồ sơ người dùng.
verifiedbooleanTài khoản có được xác minh không.
verified_typestringLoại xác minh, như Business.
Ví dụ thành công
{
"data": {
"id": "44196397",
"name": "Elon Musk",
"username": "elonmusk",
"profile_image_url": "https://img.example/profile.jpg",
"public_metrics": {
"followers_count": 10,
"following_count": 20,
"tweet_count": 40
},
"verified": true
}
}Phản hồi lỗi
Xem Mã lỗi và khắc phục để có tham chiếu mã đầy đủ, khác biệt giao thức và bước chẩn đoán.
{
"success": false,
"error": {
"code": 40000,
"message": "Insufficient credit. Required: 100000, Available: 99999"
},
"requestId": "req_xxx"
}Khi nào nên dùng
- Bạn đã có
idngười dùng - Bạn muốn tránh ảnh hưởng từ thay đổi tên người dùng
- Bạn muốn xử lý
User Infonhư tài nguyên/users/{id}tiêu chuẩn