Instagram API cant find info on Private Profiles

浪子不回头ぞ 提交于 2019-12-23 07:06:02

问题


My question is very similar to this one.

The Instagram app that I am working on is in SandBox Mode

In my app I first get public_content permission to get the necessary info I need.
But when I am trying to get the info of a private account that the authenticated user follows, I get an APINotAllowedError error

This is the API endpoint that I am trying to access: https://api.instagram.com/v1/users/PRIVATE_PROFILE/media/recent/?access_token=TOKEN_OF_USER_THAT_FOLLOWS_PRIVATE_PROFILE

Both of the accounts are invited to the sandbox app, and I can get the recent media from the private account if i set it to public, using the same code.

Is this how the API is supposed to work, because you should be able to get the info of a private user from a user that follows him.


回答1:


Use the GET relationship endpoint.

https://api.instagram.com/v1/users/user-id/relationship

This endpoint returns a BOOL value “target_user_is_private”.

or try this out

You can use the User Media endpoint with client_id:

https://api.instagram.com/v1/users/USER_ID/media/recent/?client_id=YOUR-CLIENT_ID

If the user is private you will get a response like this:

{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}

If the user is public, then you will get API response with "code":200 with user recent media data – "data":[...]




回答2:


First of all this is not an answer for the question, I do not have enough reputation to give you a comment. All information about a private user is not accessible, we will get their very less detail using there user ID. I have faced same situation, I do not have code with me now. You can read this > General terms > point 15.(no codes, just to point out the private data accessibility)



来源:https://stackoverflow.com/questions/34371309/instagram-api-cant-find-info-on-private-profiles

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