Is it possible to get instagram media for a location with a foursquare id in a single call? - api

I have a bunch of foursquare ids and I want to be able to pull instagram media with those foursquare ids.
Currently I only see one way to do this and it requires two API calls. You must first do a call to the search API using foursquare_v2_id (example call). That will return the instagram ID. Then I must do a second call to the media API using the instagram id to retrieve media (example call).
Does anyone know how to achieve these results (getting media for a location based on just a foursquare_id) with only one api call?

You can get this information through the foursquare API, with the venues/photos endpoint. See the documentation here.
This will return a list of photos for the venue, including their source. You can use this to either return all images for a venue, or just those from instagram.

After contacting Instagram it is clear that there is no way to do this at this time. If that ever changes I will come back and re-answer this question with the proper solution.

I think you have to user below api to get instagram images:
https://api.foursquare.com/v2/venues/423a1a00f964a5202f201fe3/photos?oauth_token=Z5RRDGQUWEAFCANX2OT0R2O5QUWYOP1EMOCNXT1PQWKMHVNG&v=20130706&limit=200
Using foursquare id and foursquare oaurh token you can get perticular venue images.
In response, you can check "source":{"name":"Instagram","url":"http://instagram.com"}.
source name is Instagram means it is a instagram image.
Refer: https://developer.foursquare.com/docs/venues/photos

Related

Instagram API - Can they provide likes amount?

Need to work with the Instagram API
Need these types of data, when I search an Instagram Hashtag #
Get All recent posts with this hashtag
Get Comments_Count, Likes_Count
Account name (of post writer)
Image URL (of post)
URL of post
I tried to work with the Instagram Graph API, having a bit difficulty since its API looks quite different than other APIs, did you manage to find where they put it?
Here is the relevant reference for hashtags, but you can see that there are some significant restrictions on the endpoint.
https://developers.facebook.com/docs/instagram-api/guides/hashtag-search/
You can get data for 30 hashtags a week per Business or Creator account that has authorized your app, so the endpoint is not that useful outside of a few use cases.
If you don't need to track that many hashtags, I believe you can get all of the information EXCEPT the Account Name for the post creator. You would need to register and code an app that can pass review for the Instagram Public Content Access feature and the instagram_basic permission, and then the Business or Creator account would need to authorize your app (and keep it authorized).

Using Instagram's Graph API, how can I retrieve post data (media url, caption, poster username, etc)

I want to use Instagram's Graph API on my backend server to retrieve data about an Instagram post. On my frontend, users will submit a post URL (like https://www.instagram.com/p/CAvPIm2lszQ/). Then on my backend, I want to take the ID of the post from that URL (so in this case CAvPIm2lszQ) and then I'm hoping that I can pass that ID thru the Instagram Graph API and then retrieve the data that I need (media URL, caption, poster username, etc.).
So would that be possible? I did find documentation on "IG Media" for the Graph API, but under permissions, it says, "A Facebook User access token from a User who created the IG Media object, with the following permissions.."
Unless I'm misunderstanding it, I'm not sure if I'll be able to access posts from various public accounts. I think it's also worth mentioning that my users are not logging into their Instagram accounts to use my service so the only possible "User access token" would be my own.
Any ideas on how I can go about this? I was using the instagram.com/p/{post_id}/?__a=1 endpoint to meet my needs before but it doesn't work on my production server for some reason. So I'm kinda stuck.
Most probably you will not be able to achieve that using Instagram API. First of all the ID you are referring to CAvPIm2lszQ is not the ID that you will use for getting IG Media. The ID is different (it's numeric value like in the sample request from the page you've linked). The full URL that includes CAvPIm2lszQ is in the shortcode field.
At the moment it is not possible to look for the post detail using shortcode. If you want to use that endpoint you need to get the real post ID first, for instance by listing list of posts from given user.
But in order to do so - you need to use Facebook login authorization window to get token from given user. Alternatively you can try to request https://developers.facebook.com/docs/instagram-api/guides/business-discovery but it requires going through App review and having your own company to pass the Business Verification. Keep in mind that this endpoint returns information only about Instagram Professional accounts (Business/Creator account). You will not be able to get information about regular accounts.
And the last thing about ?__a=1 endpoint. This is not the official Instagram API. They use it only for their own purposes. Most probably your server IP address has been blocked due to sending too many requests.

How to get the user's name from the Instagram API?

The Instagram Basic Display API "allows you to get a user's profile" though is there a way to retrieve the Full Name of the user?
https://developers.facebook.com/docs/instagram-basic-display-api/reference/user
The link above shows that you can return the username but cannot get anything meaningful such as their Name, website or Bio - though you are able to get all of their media.
I believe it is possible with the Graph API (which is for professional accounts) but is there a way to do so with the Basic Display API?
The easiest way would be to send a GET request to https://instagram.com/{username}/?__a=1. You'll find what you need inside ['graphql']['user']

Instagram API - Is it possible to search for a users hashtag posts

Is it possible to search all posts with a specific hashtag by a certain user?
I am new to development and I am trying out Instagram's API if I can search such combination.
It is possible, but not using only a single request to Instagram's API. There are two solutions:
Search for posts by given hashtag's name using GET /tags/{tag-name}/media/recent request and then manually check every post if its user is the user you want.
Search for posts by specific user using GET /users/{user-id}/media/recent request and then manually check every post if its tags array contains the specific hashtag you want.
I would recommend to choose the solution in which you can expect less results (posts) to filter. In most cases it means the second one, because there is more posts on Instagram with a specific hashtag than an average user share on its Instagram's accout.
You can test Instagram's API requests with Instagram's API Console: http://instagram.com/developer/api-console/

foursquare api - anyway to find original instagram post

I'm using the foursquare api to get photos for checkins. Its clear the source of a lot of these checkins is instagram.
When I pull the photo down, is there a way to get the original instagram url? Not just for the photo but the detail ie:
http://instagram.com/p/IZm_2Owxda/
There's no direct way to retrieve the Instagram URL from the Foursquare API. You can try taking a look at Instagram's locations/search endpoint to map a Foursquare venue ID to a Instagram location ID and see if this can somehow meet your needs.
There is an instagram api to search for foursquare locations and then you can see all instagram photos posted at that location. There is an implementation in gramfeed.com/instagram/places to do this search, look for foursquare locations and then look for instagram photos posted there