0

Hello im working on a instagram api, i don't know how to solve a problem. You can see my problem here down:

I want to get all photos by a tag. by now, i just can get recent photos (no more than 19 results)

$api = "https://api.instagram.com/v1/tags/".$hashtag."/media/recent?client_id=".$client;

how can i make it work?

Santiago
  • 1
  • 1

1 Answers1

1

Instagram API will not return all photos with a single API call, each call I think returns a maximum of 20 photos. After making the first API call, you have to use the "next_url" in "pagination" of JSON response to make another API call to get the next set of 20 images, for example you may have to implement a "show more" button which will load the next set and so on.

Below is a typical response you get from a instagram API, then making a request to API url at pagination.next_url will return you the next set of photos.

{
    "meta": {
        "code": 200
    },
    "data": {
        ...
    },
    "pagination": {
        "next_url": "...",
        "next_max_id": "13872296"
    }
}
krisrak
  • 12,882
  • 3
  • 32
  • 46
  • Could you please help me? how must i do to add the "show more" button? YOU can se my code here: http://codepen.io/anon/pen/EFgqv – Santiago Nov 21 '13 at 14:31