Instagram tag search - filter for images and tags after a certain time or id - api

I am using the Instagram API to fetch a list of photos tagged with a certain hashtag. I've got a real-time subscription set up so it will notify me whenever new photos have been posted. However, I have to fetch the new results myself.
My problem: When I request the list of recently tagged photos, I get a large list and I don't want to process all of the results in the recent list every time I do this. The api docs say I can pass these optional parameters, but they seem counter-intuitive. They seem to be the opposite of what I would expect:
MIN_ID Return media before this min_id.
MAX_ID Return media after this max_id.
If I keep track of the most recent media id I've seen in my recent requests, how do I construct my next request to only return results newer than that id?
I've posted two photos with a test hashtag. When I use the following url (with my real access_token in it), I get back a json response listing both of those photos:
https://api.instagram.com/v1/tags/weirdtest/media/recent?access_token=xxx
The two photos have these ids:
221201236060507271_179249322
221190263853517857_179249322
How do I construct a query that returns only the newer of those two photos?

Tack the most recent ID you've seen on the end, using the MAX_ID request parameter:
https://api.instagram.com/v1/tags/weirdtest/media/recent?access_token=xxx&MAX_ID=221201236060507271_179249322
This should tell Instagram, *"The most recent photo I've seen is 221201236060507271_179249322, return only newer photos"*.

Related

eBay API: get watch count for the particular item

I want to retrieve a number of watchers for the particular item using eBay API. I tried setting IncludeWatchCount to true in GetSingleItem request, but it appears that it works only for the seller of the item. Is it possible to get the number of watchers without being a seller?
I literally just joined in on SO with a new account because I lost my previous email with which I had the old one just to answer your question.
Anyway, If you call findItemsAdvanced, under listingInfo there is a watchCount field. It only works with findItemsAdvanced and not with any other.
[NOTE] The watchCount variable is not in the documentation. You should dump the response given by findItemsAdvanced, find listingInfo and it will be there

What is the proper way to format a GET request to retrieve all media items of the Instagram user "self"?

Looking at https://www.instagram.com/developer/endpoints/users/ I have gathered that calling https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN will return "the most recent media published by the owner of the access_token."
In sandbox mode I understand that I will receive a maximum of 20 media items from this call. I also realize that the response code has a pagination object that I can use to retrieve up to 20 more media items (see below)
"pagination": {
"next_max_tag_id": "1387272337517",
"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead",
"next_max_id": "1387272337517",
"next_min_id": "1387272345517",
"min_tag_id": "1387272345517",
"next_url": "https://api.instagram.com/v1/tags/cats/media/recent?access_token=xxx&max_tag_id=1387272337517"
}
These are the listed parameters of this Request.
PARAMETERS
ACCESS_TOKEN A valid access token.
MAX_ID Return media earlier than this max_id.
MIN_ID Return media later than this min_id.
COUNT Count of media to return.
My question is: Is there a way to structure my GET request in a way that returns all media items from a single call? I understand that this is not possible in sandbox mode, given a user with more than 20 media items. If possible please provide a detailed explanation of the COUNT parameter.
I imagine a possible GET request would look like https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN?COUNT=X
Thank you. <3
When you go live mode you can use the count= param to get more than 20 in one API call, however I have noticed that count=33 is the maximum you can get for this API call, even if you anything more than 33, it only returns 33.
You still have to use the pagination in JSON response to get the next set of media items, easiest way is to use the pagination.next_url to make API call and get next set of media items

instagram fetch by tag

I need fetch instagram posts by tag every n minutes.. I use
https://api.instagram.com/v1/tags/MYTAG/media/recent?access_token=xx.xxxx
ok, but I don't want to get the same posts every time, I want just to fetch only the new posts.. I thought to use a param.. (for example created_time), save it, and to use it like a filter param in the next request, to save the created_time field of the last post.. save it, repeat this.
but API only allow this parameters:
PARAMETERS
COUNT Count of tagged media to return.
MIN_TAG_ID Return media before this min_tag_id.
MAX_TAG_ID Return media after this max_tag_id.
Then I thought using MIN_TAG_ID in the request instead of Created_time, but the TAG_ID is not found in the api's response json ... (I can filter by TAG_ID but TAG_ID not come in the response. Unusual!!)
Any ideas?
In the response it is simply called id not tag_id
I recomend you to use subscriptions. And you will process new posts in real-time.

Is it correct that the Instagram Location/Search endpoint does NOT support pagination?

I have read several postings about the fact that the Instagram API returns only 20 results at a time. In many cases, people have suggested that all you need to do is to use the next URL which is returned in the pagination information. I would be fine with that, but the JSON returned by
https://api.instagram.com/v1/locations/search?
does not appear to have any pagination information. I have seen a posting that says that /media/search does not support pagination. I just wanted to confirm that the same is true for /locations/search. Can anyone confirm?
And if this is correct, does anyone have any thoughts about how you can get a list of all Instagram events in a specific area, rather than just the first 20 or so?
/media/search end point does not have pagination, but you can get next set of 20 pics by using url param max_timestamp, get the created_time of the last photo in api response and apply it as max_timestamp for next url call, it will return the next 20. Thats how I implemented here: http://www.gramfeed.com/instagram/map
for locations/search end point, timestamp does not apply, you can change distance url param and get more results: http://www.gramfeed.com/instagram/places

Accessing Flixster data

Is there any way of accessing the data on Flixster? Specifically, I'd like to retrieve a list of all of my movie ratings. I know you can get an rss feed of these, but it only appears to return a subset of all of the ratings.
View your Rotten Tomatoes / Flixster movie ratings by accessing this URL, first replacing USERIDHERE in the URL.
http://community.flixster.com/api/v1/users/USERIDHERE/ratings.rss
You can find out your user id by clicking to view your Profile, which will contain your unique id in the URL, such as:
http://www.flixster.com/user/USERIDHERE/
Yes, there is a new-ish Rotten-Tomatoes API at http://developer.rottentomatoes.com/docs/read/json/v10/Movie_Reviews
Here's a simple program, using the API, that I've found:
https://github.com/mmihaljevic/flixter
...and you can read her blog post for more information.
Just tested both fetching and parsing, and it still appears to work.