Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram API cant find info on Private Profiles

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.

like image 304
FastFarm Avatar asked Dec 19 '15 13:12

FastFarm


1 Answers

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":[...]

like image 180
youngdero Avatar answered Oct 07 '22 19:10

youngdero