Instagram API multiple requests - instagram

I'm developing an app using Instagram API. I need to fetch:
1) the list of users my user follows (https://www.instagram.com/developer/endpoints/relationships/#get_users_follows)
2) the list of users my user is followed by (https://www.instagram.com/developer/endpoints/relationships/#get_users_followed_by).
It is not a problem, but for each user I want to have an info about a number of "follows" and "followed_by". Unfortunately, endpoints I provide above don't return this numbers. So as far as I understood I need to call the next endpoint https://www.instagram.com/developer/endpoints/users/#get_users for each user in the lists. It is too many calls, that is why I need to join these API calls in one call. Is there any way to make something like "batch request"?
I checked Instagram API documentation here https://www.instagram.com/developer/ and the similar question here https://stackoverflow.com/questions/32909284/instagram-api-batch-request. But there are no answers for my question.
Thanks in advance.

When user is passing OAuth2 protocol, instagram api will return 2 arguments to you the first is 'access_token' and the second is 'user_info' i think in user_info there is a 'count' key, and that is your need.

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.

Foursquare API endpoint user/<friendID>/friends returns 0 results after friendship accepted

I've created a Foursquare account and added a friend. The friend has accepted the request and the website shows that I've got 1 follower and that I'm following 1 person. When I attempt to access the user's friend list through the API, I find that 0 friends are returned. I'm accessing https://api.foursquare.com/v2/users/99240765/friends with my current valid credentials and I get an empty friend array.
Is there a certain state that I need to get into in order to have my friend list returned through the API? have I not accepted some terms or is this a bug?
I heard back from the nice folks at Foursquare. The appropriate endpoint to hit is
users/<id>/following
while passing in the additional parameter
m=foursquare

How to grab instagram users based on a hashtag?

is there a way to grab instagram users based on a specific hashtag ?
I run contests based on re posting photos with specified hashtag then randomly pick a winner, i need a tool that can grab the usernames of those who reposted that photo and used that hashtag.
You can query instagram using the API. There are official clients for both python and ruby.
You didn't specify what language/platform you are using, so I'll give you the generic approach.
Query instagram using the Tag Recent Media endpoint.
In the response, you will receive a user object that has the user's username, id, profile url, and so on. This should be enough to do what you are describing.
As far as tools, there aren't great options to probably do things exactly how you want. If you just want a simple contest, you could use statigram, but it's not free.
If you roll your own solution, I highly recommend you also do the following:
Implement a rate limiting mechanism such as a task queue so you don't exceed your API calls (5000 per hour for most calls). Also useful for failures/network hicups, etc.
Have users authenticate so you can use OAuth to extend your API calls to 5000/per user/hour to get around #1.
Try the subscribe API if there won't be many items. You can subscribe to a specific tag as well, and you will get a change notification. At that point though you need to retrieve the actual media item(s), and this can cost a lot of API calls depending on how frequent and what volume these changes occur.
If your users don't have much photos/relatively small/known in advance, you can actually query the user's recent media instead and filter in your own code by hash tag.

Why will Foursquare hereNow endpoint not return items?

My application uses hereNow api. I checked-in CORRECTLY (i.e. physically present in the location) to a venue and then var_dump the request response from calling the hereNow endpoint, so it returns "count" but "items" is empty as shown below.
string '{"meta":{"code":200},"notifications":[{"type":"notificationTray","item":{"unreadCount":1}}],"response":{"hereNow":{"count":1,"items":[]}}}' (length=138)
I attempted the same thing using foursquare explorer but obtained similar result. Could you kindly explain why this could be so and what is the idea behind "unreadcount". Thank you.
a) Make sure that the OAuth token you are using to make the hereNow request is for the same user who checked in. You must be acting on behalf of a user who has checked in to a venue to see who is "here now"
b) It's possible that your check-in is being recognized as a cheat because you have checked in too frequently recently, or the lat/long coordinates provided by your device were not accurate enough.

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