Instagram API /v1/users/self/media/recent with min_id doesn't performing as doc said - instagram

I am trying to fetch my post feed through Instagram API.
I can fetch all posts by using below URL:
https://api.instagram.com/v1/users/self/media/recent?access_token=3316953021.24c30bf.5ecbae4a6b4840b68a499c01ba611c4d
I can use the same API with max_id to fetch earlier posts.
https://api.instagram.com/v1/users/3316953021/media/recent?access_token=3316953021.24c30bf.5ecbae4a6b4840b68a499c01ba611c4d&count=2&max_id=1272062614682155664_3316953021
However, when I followed Instagram docs to fetch post later than min_id post. It doesn't work as it promised.
https://api.instagram.com/v1/users/self/media/recent?access_token=3316953021.24c30bf.5ecbae4a6b4840b68a499c01ba611c4d&count=2&min_id=1272064038816135869_3316953021
It supposed to get two later posts after the min_id post. But, it actually, get post start with the latest post.
Moreover, If the min_id is the latest post id, the response will start with the latest post.
Then, I found whatever I use min_id, the API will perform equivalent with below one
https://api.instagram.com/v1/users/self/media/recent?access_token=3316953021.24c30bf.5ecbae4a6b4840b68a499c01ba611c4d&count=2
It means the min_id never works.
Question: Any one has experience to fetch feed by set min_id? Where am I wrong in my url?
P.S. The access token is working, you can click the URL to test it.

I don't believe you're doing anything wrong. I think this param has 'broken' with the update to IG's API recently. I've submitted an issue with them, and it would be helpful probably if you did, too.
I see similar issues being posted on StackOverflow, using the param with different endpoints. So I doubt it's 'user error.'

Related

Weird Issue With Instagram API

Issue:
First API calls only returns top 3 posts.
The next_url returns no data(data array is empty and pagination string is null)
The 4th post is suspect because I am unable to get it with API calls and it is not returned in the first API call.
Details:
Using v1/users/self/media/recent endpoint
Using Javascript to loop through calls, using "next_url" for the 2nd and subsequent call.
Using Access Token
Worked fine(returned all posts) until "the 4th post" was made
Why do I think one specific post is the issue? Because I am unable to retrieve it using the API. If I set the max_id to this post id, then I get all other posts before this post.
If I leave max_id out, the first call gets all posts newer than this post.
Verified that I am not in a Sandbox.
Has anyone encountered this before? and why would one post be breaking the next_url API call? Is there something in the post causing this?
I can't give out the IG account, sorry I know that would help, but it needs to remain private.
I am a developer on a project that makes extensive use of the legacy Instagram API. It has, for a long while now, been extremely flakey. We have experienced your exact issue many times and there is no practical solution.
However, all Instagram APIs have now (finally!) been migrated to Facebook. You should use the new Instagram Basic Display API which will be properly supported going forward.

Is instagram users/self/media/recent API deprecating? [duplicate]

This question already exists:
Instagram/Facebook deprecating many APIs [duplicate]
Closed 4 years ago.
As a result of their Cambridge Analytica damage-limitation, Facebook have just announced a bunch of immediate changes to the Facebook APIs and the Instagram APIs.
I have a running project that makes heavy use of Instagram API users/self/media/recent
Reference Link: https://www.instagram.com/developer/changelog/
According to this reference url, api /users/{user-id}/media/recent is depriciating soon, So in my case I am also making use of /media/recent api but on {self} and not using {user-id}.
So my question to you guys is - Are both of these API's same and both are going to be discontinued? (I strongly hope thats not the case :) )
If yes, then what is the possible alternate to fetch instagram recent user feed?
Thanks in advance.
yes, you can get this data
check this link
https://www.instagram.com/selenagomez/?__a=1
just change your username and you will be able to fetch data
They are the same (when using 'self' obviously), it will be deprecated
sometime in the future but not just now, I just tested them and it
works
https://api.instagram.com/v1/users/self/media/recent?access_token=[YOUR_ACCESS_TOKEN]
This endpoint is now retired, so this response is no longer valid. Should I delete or just let this edit ?
This API endpoint like all old Instagram API will be deprecated. You can read the note here: https://www.instagram.com/developer/
They are migrating to Facebook Graph API. I believe that all developers using old Instagram API will have to migrate at some point to FB Graph API. Currently there is no support for fetching media from regular users. FB Graph API is running only for Instagram Business Accounts.
Most probably they will add support for regular Instagram accounts in the future. They are adding new endpoints so sooner or later equivalent to /users/self/media will be available in Graph API.

Facebook Graph API permission issue

I have a problem with querying the Facebook Graph API and reading with extended permissions. I want to query a page's latest posts with additional data for a reporting dashboard (show the number of likes, reactions and post impressions) I have an express app with passport-facebook running in order for the user to authenticate and provide the permissions in question. This setup used to work before, but now I am experiencing a strange problem.
This is what I am requesting: created_time,link,full_picture,message_tags,with_tags{link},message,reactions.summary(true),insights.metric(post_impressions)
I had my app in Facebook's review process and they granted me the read_insights permission for querying insights.metric(post_impressions). After the review I was able to pull all the data I needed from the API. That was 2 weeks ago. Today I experienced the problem that I can only pull very limited data out of the API. The response keeps giving me Permission error (OAuthException), stating "User doesn't have enough permissions to load insights", "You do not have enough permission to view the metric."
However, when I add the limit and/or the after params to the query I do get data back, but only with very low values for limit (that is <= 5, but after 2 paginated requests, no subsequent requests are allowed) or a value for after, which I don't have for an inital request.
Has there been a change to the API (couldn't find anything in the changelog)? Maybe I'm just overlooking something trivial?
Thanks!
Since nobody else (not here or anywhere else I asked for help) seemed to have experienced the issue I filed a bug at Facebook and it turned out to be an individual problem with some item(s) on my page's feed. Here's their response:
This is a particular issue with one or more specific posts from that page feed, that is causing the entire call to fail when trying to include it.
This issue might be addressed in a future version of Graph API. There are two workarounds for now: either use a page access token or if sticking with a user access token, giving it granular permissions to the pages.
I've tried option 1 and a page access token seems to fix the issue.

Pagination with /locations/location-id/media/recent Instagram

I'm using https://api.instagram.com/v1/locations/{location-id}/media/recent endpoint of the Instagram API to fetch posts in a specific location, but i'm having an issue implementing pagination.
the request https://api.instagram.com/v1/locations/106970059456743/media/recent?ACCESS_TOKEN=(ACCESS_TOKEN)
the problem comes with the MAX_ID and MIN_ID parameters, because in the response i get from the first query the pagination object comes empty (see https://www.instagram.com/developer/endpoints/), i've tried pluggin in the id's of the most recent posts in the parameters and that doesn't seem to work when i'm asking for new posts, but it does work whem i'm asking for older post.
i've successfully implemented the pagination for the https://api.instagram.com/v1/tags/{tag}/media/recent endpoint but apparently this endpoints use different paginations (media/recent does return a pagination object in the response).
If you are in Sandbox mode, you can only get 20 posts in API response in sandbox mode, pagination will not work in sandbox, this is expected behavior. When u go live mode u will get all posts and pagination.

graph api search not returning a post

I am searching using https://graph.facebook.com/search?q=anglogold&type=post
this is not returning a post I made myself just now. Any idea why
https://graph.facebook.com/search?q=anglogold&type=post
returns a lot of posts for me.
Facebook can restrict results on search api on different scenarios.
Not suitable for a particular country/region
Not a public post
Person is blocked by user
and may be few others.

Resources