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.
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":[...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With