Reputation: 1
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?
Upvotes: 0
Views: 1339
Reputation: 12952
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"
}
}
Upvotes: 1