Search code examples
phptokeninstagraminstagram-api

Instagram API parameter to return data from users which requesting user follows


I am using Instagrams rest API and making this http request to get photos taken at certain lat and lng paramaters.

eg

https://api.instagram.com/v1/media/search?lat=51.5073509&lng=-0.1277583&access_token='access-token'

Is there a parameter I can add to this so only pictures from users which I (or the user identified from their access token) follow, or pictures which I have liked, are returned.

Thanks


Solution

  • You cannot just get posts from users you follow or just the ones you have liked.

    You will get all public posts, you can check the user_has_liked=ture/false key in the json response for each posts to see if you have liked it.

    To check if you follow the user or not, you will have to make another API for each of the post using the user_id: https://api.instagram.com/v1/users/3/relationship?access_token=XXX and look for outgoing_status in json response