2015-06-17 72 views
2

我使用Instagram的API(OAuth的),我能使用如何在Instagram API中獲取用戶關注者?

https://api.instagram.com/oauth/authorize/client_id='.$client_id.'&redirect_uri='.$redirect_url .'&response_type=code'

https://api.instagram.com/oauth/access_token通過傳遞客戶端ID,祕密和REDIRECT_URI獲得訪問令牌和用戶信息。

當我撥打第一個電話 (https://api.instagram.com/oauth/authorize/client_id='.$client_id.'&redirect_uri='.$redirect_url .'&response_type=code')它給了我access_token和用戶的數組。

我的問題是我該怎麼做才能獲得用戶的關注者?

我知道我必須使用https://api.instagram.com/v1/users/{user-id}/follows?access_token=ACCESS-TOKEN,但由於某種原因,我收到錯誤消息

{ 
"code": 400, 
"error_type": "OAuthException", 
"error_message": "Only response type \"code\" and \"token\" is allowed" 
} 

請幫助!

回答

2

首先,您不需要進行身份驗證(即需要access_token)以獲取用戶關注者列表。你只需要你的client_id

以下請求應該在你的情況下工作:

https://api.instagram.com/v1/users/{user-id}/follows/?client_id={client_id}

0

按照新的更新,你必須使用訪問令牌,而不是CLIENT_ID

這是我的迴應 {"data": {"id": "1829538552", "username": "mypageusername", "profile_picture": " https://scontent.cdninstagram.com/t51.2885-19/11084945_1580533368872297_743341297_a.jpg ", "full_name": "pagename Nation", "bio": "For Business/Ads\[email protected]\nKik: @test", "website": " https://carsmydrug.myshopify.com/ ", "counts": {"media": 371, "follows": 6464, "followed_by": 171599}}, "meta": {"code": 200}}

這是得到以上回復的網址 https://api.instagram.com/v1/users/1829538552/?access_token=1829538552.81758e8.5d303d9dd94543efb17684dee425cb5a

你必須獲得訪問令牌,你只能檢查接受你的沙箱用戶的用戶列表

相關問題