I’m using the Instagram API in sandbox mode. I’m trying to access a User’s liked posts from the Instagram API using their authenticated access token. This user is one of the accepted sandbox users for my app, and has liked some posts.
If I call other endpoints with the same token, I get some data, but accessing /users/self/media/liked
returns empty data.
I’m using this URL:
https://api.instagram.com/v1/users/self/media/liked?access_token={verified access token}
and this is the result I’m receiving:
{"pagination": {}, "meta": {"code": 200}, "data": []}
Because it has a 200 return code, the access token is valid. So why don’t I see any liked posts?
When your app behaves in sandbox mode, it’s restricted compared to normal behaviour. In particular (quoting from the API docs for the sandbox):
The API behaves as if the only users on Instagram were your sandbox users, and the only media ever posted were the last 20 for each of these users.
So the API can’t see posts that the user has liked if those posts were made by non-sandbox users.
Here's a scenario:
Assumptions:
Now, as Instagram document has said: Here will be the black box flow.
Situation 1:: APP1 tries to accept user likes for sandbox/non-sandbox users - Result: it gets their data. Reason: For live apps, number of users visible to the app is the the number of users available on instagram.
Situation 2:: APP2 tries to accept user likes: For sandbox user - It will get only those data(likes here) for which the users are registered as sandbox users for this app. Any other likes for non-sandbox users will be not visible here. {As if 5 users existed, if any users like any content of those 5 users, it will be visible.} For non-sandbox users - Users are not visible!
I missed the last part of visibility, which took me some research and co-relation to find out. I guess there might me other developers who might have not understood the sandbox user's visibility part of the document.
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