Instagram API - Getting feed of private user whom the authorised user follows

北城以北 提交于 2019-12-07 02:10:43

问题


I am using Instagram API for my application. I need access to the feed of private users whom I am following, but the response is:

code: 400
error_type: APINotAllowedError
error_message: you cannot view this resource

I could not find anything in the documentation regarding this. I was hoping that as I am able to see the user's feed on my app, I would be able to retrieve the same using the API.

Any way around this? Please help.


回答1:


[As instagram changes their api, this tips may not work forever]

I faced same issue and the cause is it happens when the posts are private , even if user access token is passed with endpoints this errors happen.

Solution: just in place of userid use 'self' for private profile. means if a profile has private posts then who connects should be the same person of the profile and other person can not view his/her posts.

Example:

https://api.instagram.com/v1/users/USER_ID/media/recent/?access_token=USER_ACCESS_TOKEN_HERE if this endpoints shows error then use https://api.instagram.com/v1/users/self/media/recent/?access_token=USER_ACCESS_TOKEN_HERE

(just replace 'userid' with 'self')



来源:https://stackoverflow.com/questions/23600510/instagram-api-getting-feed-of-private-user-whom-the-authorised-user-follows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!