instagram api comments fetch - api

Is there a way to determine when a new comment is posted without refetching all data? Does instagram return the results set in chronological order and can a user update a comment and does this alter the created date time? Just starting to look at the api and documentation does not clarify this.

Get a full list of comments on a media object. Go here http://instagram.com/developer/endpoints/comments/#get_media_comments

Related

How to get group posts and their comments from Workplace Graph API in a single request?

I know I can get all the posts in a group using the Graph API endpoint /group-id/feed. And I know I can get all the comments of a single post too. But I want to know if it's possible to get the comments of each posts in a group in a single request.
Ideally, I would want something like "get the latest 10 posts of a group with their comments" in a single request.
Couldn't find anything in the docs so it's probably not possible.
you can use the fields parameter
/group-id/feed?fields=message,comments
in this way you are able to retrieve the message of the post and all the comments related to it

Instagram realtime get post from callback

Right, this is really working on my nerves, but Instagram has to do something about their bloody documentation.
I am already trying for a week to live update my website with new instagram posts without refreshing the page. Twitter was fairly easy, but instagram is just one big mess. Basically I use the realtime Instagram API, the callback and all that stuff is working fine, but thanks to Instagram it does not return me an ID from the post that is new, the callback only returns some basic stuff:
[{"changed_aspect": "media", "object": "tag", "object_id": "nofilter", "time": 1391091743, "subscription_id": xxxxx, "data": {}}]
with this data you are nothing, except for the Tag, but I knew the tag before this callback too so doesn't matter. It actually only tells me that there is a new post. I have tried doing the same request as when the page loads, when this callback occurs, and get the posts that are newer than those already on the page. Unfortunately I have not succeeded in this yet. I have picked the ID from the last posted instagram post, and checked if it is in the callback request, and it's not.
What am I doing wrong?
I'd appreciate some help, thanks!
Edit:
I'd like to note that this is not only a problem with the realtime api, but also with the normal API. I just don't know how to compare data so I don't get duplicates in my database(normal api), or on my website (realtime). I can't find any tutorial or documentation (Yes, I might be blind), that explains to me how to compare data. I can only find the min_id and max_id, but no explanation what these id's contains. I checked these id's with id's from results, and they do not match. It's not an ID from a media item.
I also checked the next_url, and in my logic thinking, this should be a URL to the next page (like Twitter).
Am I looking at this all wrong?
Ok strike my old answer, I changed the way I do this. Here's how I'll do it now.
I still wait for 10 hits on my Real-time subscription, when I reach 10 I send off a new thread (if one is not already running).
The sync thread queries my DB for a value, I need the last min_tag_id I used. Then I query:
https://api.instagram.com/v1/tags/*/media/recent?access_token=*&min_tag_id=*
Try it out here: https://api.instagram.com/v1/tags/montreal/media/recent?access_token=*
You'll get 20 results, and a min_tag_id value. Append that to your url, you'll see you get no results. Wait a couple of seconds and refresh. Eventually you'll get some media, and a new min_tag_id.
(You can ignore the "next_url" value they give you, you won't be using that).
Basically you only need to store that min_tag_id and query until you have no more results, that means you're done then.
When you get a subscription push, you need to query that endpoint (tag / recent).
I normally start an synchronous thread to perform this so I can answer in under 2 seconds to Instagram.
Then you parse that endpoint and look for a "next url" value.
Keep querying that end point, parsing the media and going to the next url until you find your stop condition.
For me I try to match 10 consecutive records in my DB. Basically from the tag, I store media when then meet my business rules.
The Instagram documentation is accurate and actually well written.
The realtime API is working correctly. As stated in the documentation:
The changed data is not included in the payload, so it is up to you
how you'd like to fetch the new data. For example, you may decide only
to fetch new data for specific users, or after a certain number of
photos have been posted.
http://instagram.com/developer/realtime/
You only receive a notification that an update has happened to your subscribed object. It is up to you to call the API to find out what that data is.
You can call the /tags/[tag-name]/media/recent with an access token that you have previously stored on your own server or DB. Then, you should be able to compare the data returned from that endpoint with any data you have retrieved prior, and just pull the objects that you do not yet have.

BigCommerce - Is there a way to write data to a database from store and then retrieve it and display it on Front End?

I'm not sure if this is possible.
I'm looking to create a Question and Answer widget for a BigCommerce store. The idea is the user will type in a question on the product page, the question will get added to a MySQL database on a different server. The store owner would then access an edit page on the other server and either reply and post, reply or delete the question. If the store owner decides to reply and post, the question and answer would then be displayed on the original product page.
The part that I'm not sure how to do is the last part: displaying the question and answer on the original product page.
Thanks,
You won't be able to pull it in via the Bigcommerce platform itself, but why not pull the content in with javascript? It's not ideal, but you should be able to get that to work.

Instagram fetching tag recent user media after a max_id

Lets asume I fetch recent user media for a tag... And that I am able of storing in a database the information that it is returned to me by the API.
The media ids are something like [0-9]+_[0-9]+, and lets asume that one day later, I want to fetch only new data, so I order the media, that I stored in my DB, by instagram's created time, then I select the one that its the newest and grab its id something like '121231232213123_12312312312'.
Then I use that Id as the max_id attribute for the API endpoint https://api.instagram.com/v1/tags/{tag_name}/media/recent, I would assume, that I would get new user_media or an empty array if no one had upload anything.
The thing is that I receive all the same data, its like if it not filtering my results nor using the max_id.
is this correct behavior or should I do something else?
thanks,
ps: I posted this same issue also on google groups:
https://groups.google.com/forum/?fromgroups#!topic/instagram-api-developers/QyjCORkjr3I
I found 2 tips, that can be useful for you:
You should use min_id, in order to get new media. max_id will return photos, older that the one with this id.
It's better to use live API in order to update your DB with new photos dynamically.
UPDATE:
Instagram live API is deprecated now. However you can now use webhooks subscription system which is very similar to facebook. Details can be found in this answer.

Can you get the exact date a user started following another using the twitter API?

Let's say user A follows user B, and B follows A. I want to know the exact date A started following B and viceversa.
Is this information stored on twitter? Can I retrieve it using the API?
To clear out: The point of this question is finding a way to know who followed who first.
(I'm assuming both A and B deleted the notification e-mails)
No Ignacio, you can't. You just can know who follows who but not the date the follow started.
Looking at the API, there's is no way, there are two calls to get the followers:
User Methods/statuses/followers
and
Social Graph Methods/followers/ids
Neither of them returns dates or even a serial that would let you see who started following first. Really, there's no indication that twitter is internally storing this information, neither in the API nor Twitter's web interface.
This is a very old question, but perhaps some might be interested to know that while you cannot get the date at which someone started following, you can at least infer an "earliest possible following date" from the fact that the list of followers is ordered according to date, and the fact that follower objects come with a created_at timestamp.
Here's a Python function for calculating an "earliest possible following date": https://github.com/BernhardClemm/twitter-follow-dates
Of course Twitter stores it, because Twitter sorts followers and following lists by the date ;)
It is possible to do this, but impractical. When you call the followers API you can page the results. Each returned object contains next_cursor and prev_cursor items. These refer to the first and last records in the next and previous pages. These values are time based and can be used to calculate the time that the respective users followed you.
It follows that, if you set the page size to 1, you can walk through the list of follower IDs one at a time and the next_cursor value will allow you to derive the follow time for the next record.
This is reasonably simple to implement, however, in practice, you'll very quickly hit Twitter's API rate limit.