Instagram API: Get the oldest images first based on tagname - rest

I recently developed an app using the Instagram API, But I faced some problems with it. (I got struck)
This app is not calling the api and getting images in the real-time. Instead, it calls the api once a week and store images in the database based on a specific hashtag. I see that their api is designed in a way to call it in real time and pull images, because it has this "recent" in its url, and it only provides 20 results. So every time a user reaches the end, it will load the next 20, until u reach the end.
However, in my case, When I pull the images every week, at one point, I will reach to the oldest image, and from that point I will be stopped, because Im going from Newest to the oldest. So I want to get data as from oldest to newest.( Actually I want to get the opposite of what's offered by instagram.) They have not provided any option to sort them in their docs.
Im thinking of a solution for this, but I can't wrap my head around it. So I will be much thankful if you guys can direct me in the right path.
I searched Google, viewed old questions in SO, but I didn't find the answer.
Edit : Im planning to fetch data starting from the Oldest one like this. (Since I know the min_tag_id, because I ran this once completely).
https://api.instagram.com/v1/tags/my_tag/media/recent?&client_id=xxxxxxxxxxxxxxx&min_tag_id=1408983759354183
where min_tag_id is of the oldest image. So everytime I will be calling to the min_tag_id. Is it a good solution?

Yes, using the min_tag_id and max_tag_id is the solution.
Have a look at this answer: Instagram Search for a tag within particular date range

Related

How do I get the complete track history of a Deezer user?

I want to analyse my music consumption on Deezer.
Researching resulted in their rest api but the amount of entries in the user history seems to be limited (see https://stackoverflow.com/a/19497151/9909548 to navigate through all entries).
In my case, it resulted in only about 140 tracks which should be thousands.
From now on I could regularly store the results of that request but all data till now would be lost.
I'm aware that, by EU law, I could request all stored user data and parse that (in case I get it digitally) but I would not consider that a solution.
Is there a different api call to get the complete history or another api or some other way to get this?
There is no other way to access the entire history:
Deezer Support on 05.12.2020
Hello, Thanks for your email, apologies for the delay in getting back to you. XXX from Support here
https://www.deezer.com/app/stateeztics/
that is the best tool, but else sadly we do not have data analysis tools or data, besides recently played. Other option though: 2020 highlights (in Music)
Kind regards, XXX
The recommended app is stuck when opened and Deezer is slowly stopping their support for app extensions anyway.

Cant apply for next level rate limit Facebook marketing api

I have to create script to create adsets and ads for a facebook campaign and I have to do it for a lot of items. For now, i can create every needed entity but there is a big problem, the rate limit. I reach it pretty quick (I can create like 15 items before getting a rate limit exception) and this is very limitating, creating eveything by hand is actually much faster... I want to apply to the next level of rate limitation but I can't. One of my coworker contacted someone from facebook and we were told we did not make any API call using my app ID. Since I am able to create a campaigns, adsets, ads... and we can see those in power editor I don't understand what is going on.
What my dashboard looks like
We will need to be able to create everything using the API really soon so, after some research, I try asking the question here. Did I miss something when creating my app ?
You probably want to go through the official request to promote your app from a Basic level to a Standard level. The level for your app determines how heavily it is rate limited. Details here: https://developers.facebook.com/docs/marketing-api/access
It sounds as if you have not make your official request in app dashboard. It's possible we evaluated your number of API calls before you reached the threshold, or the data we are able to see on your API calls was from an earlier time period when you did not consistently reach the boundary.
You could also be hitting rate limits due to your error rates.
You can apply here, and if needed, reapply: https://www.facebook.com/business/standardadsapi?attachment_canonical_url=https%3A%2F%2Fwww.facebook.com%2Fbusiness%2Fstandardadsapi

How to get latest comment effectively using graph API even though comment to old post

I need to fetch the Facebook comments even though some comments are for old posts (may be a few weeks back) , but downloading the full list via Graph API and syncing it on every page view is extremely inefficient.
Does anyone knows the efficient way about how to extract the latest comments? says all comments from yesterday. Since FQL is going to be obsolete in API 2.1 so how can I do it using Graph API.
If you need to fetch the latest comments relatively often (in my case every hour) you can consider saving the last "next page cursor" for each post and try restarting from there.
From the Graph API docs -
Cursor-based pagination is the most efficient method of paging and should always be used where possible - a cursor refers to a random string of characters which mark a specific item in a list of data. Unless this item is deleted, the cursor will always point to the same part of the list, but it will be invalidated if an item is removed. Therefore, your app shouldn't store any older cursors or assume that they will still be valid.
Cursors can't be stored for long periods of time and expected to still work. They are meant to paginate through the result set in a short period of time.
Facebook expects you not to save cursors for future use, but I guess there's no harm in trying anyway and then degrade on fetching all comments (or just the first N pages) if the cursor fails.
EDIT - from my tests cursors are still valid after 12 hours. Maybe it's not a time limit expiration, it could be that a cursor is invalidated if the last comment of that page gets deleted or something.

Want to know the concept of Facebook update

I want to know how facebook gets live updates from the server. Did some analysis and found it use some sort of channels which keeps on dying and generating like
0-143.channel.facebook.com
Please give your ideas what it could be.
Thanks
Ankur Goel
Facebook uses javascript to pitch an ajax request to their servers at a specified time frame say like every 60 seconds or so and updates your UI accordingly if there's been updates.
get started http://jquery.com/ and more specifically http://api.jquery.com/jQuery.ajax/

In-App Notifications?

I'm trying to create functionality in my app that would allow me to release news updates (Via a server) to those using the app, similar to what is found in Doodle Jump:
http://farm8.staticflickr.com/7143/6463110847_d485681dac.jpg
Any sample code or ideas would be helpful.
You'll probably need to create an API/web service that your app calls on launch (or when entering foreground)...you could populate that with a database that just gives the entries since the last sync...or just returns some response that you've set up. The response should be JSON or XML formatted (I vote JSON) and then in your app, you call it, parse the response, and place/manipulate it however necessary
http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/
There are a lot of options here. In any case you will need a web server that hosts these news postings. The route that I would take is some kind of blog site, where you can easily manage posts. Then upon launching the app you make a web service call to said blog and get the news posts. You will need to keep track locally of which posts were read by the user in order to keep the badge count correct.
You could also roll your own server, but I don't really see the point for something so simple.
Another option is a web-service such as Parse
This question is too vague for code samples as we would be essentially writing the entire solution for you in order for it to make sense.
If you have further questions into how to leverage these web services, how to load the feed, how to display it etc... Break it up across multiple questions.
There's a service doing this called Converser, if you're still looking.