Weird Issue With Instagram API - instagram

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.

Related

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.

Instagram search user api always return empty result with success code

We are invoking instagram search users api to get profile list as
https://api.instagram.com/v1/users/search?q={search-term}&access_token={access-token}
but we are getting always empty result with success code as
{"meta": {"code": 200}, "data": []}
Our search term would be always instagram username i.e. username portion from https://www.instagram.com/username/
I remember this was working before 2-3 months. Any other are facing similar issue?
Sounds like you already figured out your problem. In case anyone else is having the same problem, here's a short article summarizing how Instagram's Sandbox Mode works.
TL;DR
“Sandbox mode” is the (unintuitively-named) gatekeeper walling off
most of what you want to do. This is the default status for all
clients, that have not undergone the strict submission process. An API
client in sandbox mode has extremely limited permissions. In fact, it
has fewer permissions than an anonymous user viewing public content
because your app basically lives on a tiny desert island in which you
are the only Instagram user and only your past twenty posts exist. So,
for example, the /media/search endpoint will only return the media you
uploaded near a given location, excluding the media from everyone else
or any posts beyond your last twenty.
So your API call is succeeding. It just isn't finding any results because it can only "see" other sanbox users for your client.

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

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.'

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