Search recent media and comment via Instagram API and Graph API - facebook

I want to build an app where the app user can from within the app
search Instagram's most recent media by a search term (Hashtag-Search)
post comments to Instagram posts
For searching Instagram the Graph API can't be used, because it doesn't has such capability. Therefore I need to use the old Instagram API, correct? But Instagram states "The Instagram Graph API is Now Available to All Developers. For Non-Business Instagram Accounts please continue to use the existing Instagram Platform API". The users of my platform have business accounts which I need for posting comments via the Graph API.
Do I have to use the Instagram API for searches by the app users (1.) and the Graph API for posting comments(2.)?
Is there another way to search for Instagram media which is not against Instagram policies?

Yes, You need to use both APIs; in other words, have to have access token for both apps just for the same Instagram account, doing oauth handshake to each API's authentication.
Also to note - for your first requirement: Search media by hashtags in Instagram API, you need your app to have public_content scope; which Instagram no longer approves to new apps. So, unless you have an oauth app already with this scope for Instagram API; most likely it wouldn't be possible to use developer apis for search.
For limited tag search you can use public web api:
https://www.instagram.com/explore/tags/{tagName}/?__a=1
for example: https://www.instagram.com/explore/tags/apple/?__a=1
This is just for recent media - I guess, this API does not guarantee all media.

This is no longer correct.
The graph API has the endpoint ig_hashtag_search, which will find the ID of the hashtag. You can then use it to search for media on endpoints recent_media and top_media.

Related

Instagram API for Non-Business accounts

I want to make a app for Non-Bussiness Instagram accounts.
My only problem is that when I access the old Instagram API (https://www.instagram.com/developer/) they tell me to use the new Graph API, but when I go to the Instagram Graph API reference, they says:
If you are building apps for Instagram Non-Business Accounts, please
use the Instagram Platform API instead.
(Note: The old Instagram API will be deprecated soon: https://developers.facebook.com/blog/post/2018/01/30/instagram-graph-api-updates/)
What can I do to resolve this little problem?
Instagram users can now set their accounts as 'creator accounts'. This allows the same capabilities via the Facebook Graph API as for business accounts, but without actually needing to be a business.
Details here: https://help.instagram.com/2358103564437429

How to get user data now with restrictions on instagram platform api?

There have been lots of changes to the facebook api recently, which now includes the instagram api as well. https://www.instagram.com/developer/changelog/
They have shutdown a lot of endpoints way ahead of schedule and has created a huge problem for my application which integrates instagram user data. They have the instagram graph api now, but looks like it can be used only for business accounts (looked like that prima facie). Reading through the news past couple of days, I am really confused about what is available and what is not. My application used to get user data (number of followers, recent posts, reach, likes, etc) using the instagram handle provided by users. Since this is totally restricted on the platform api now, is there a way I can have the same functionality using the new graph api? Or should I look into 3rd party APIs? I am open to asking users for authentication (I already have the facility). Can the user information be fetched after they authenticate my app to do so?
You can use the following Graph API to get all the details for any IG business account.
https://developers.facebook.com/docs/instagram-api/business-discovery

How to access Instagram feed of any user with new Graph API?

Facebook recently introduced Instagram Graph API, which allows to fetch data from Instagram page that is connected to your Facebook company page, instagram.com/developers states:
The Instagram Graph API is Now Available to All Developers.
For Non-Business Instagram Accounts please continue to use the existing Instagram API.
So, for example, if my company has account instagram.com/my_first_company, I can only retrieve its feed and no one else.
Using old Instagram API to retrieve public_content permission (access to any feed) is no longer an option too, from old API documetation:
public_content - to read any public profile info and media on a user’s
behalf (applications no longer accepted)
What will happen to existing tools that have public_content permission? (for example, there are tons of plugins for various CMS that allow to display recent Instagram photos)
Is there any valid way to access public_content (access to any feed) right now (besides fetching HTML pages of Instagram website)?
Are there any plans to enable Graph API for non-business customers, of so when?
UPD. There seem to be ?__a=1 endpoint that allows to get access to recent photos of any public feed without any tokens. But it's not official and no one knows when/if Instagram will close it. If you do - please let me know.
UPD 2. Instagram removed ?__a=1 endpoint, not sure for how long, probably forever. Currently the only way to access instagram feed is to scrap instagram.com website, which is a horror.
Prerequisite: You first need the business Instagram account to be linked with FB Page. https://help.instagram.com/356902681064399 - That one can do from the profile page of Instagram account.
Get the Instagram business account id:
graph.facebook.com/v2.8/<fbPageId>?fields=instagram_business_account. (the fbPageId is the page id of the facebook page the account is linked)
To fetch instagram media feed: graph.facebook.com/v2.8/<igBusinessId>/media to fetch the media feed of the Instagram account. (the igBusinessId is the id returned in above linked instagram_business_account) - This is still owned media as per the page access_token. Not any other user's feed.
All other endpoints (such as comments moderation, detailed insights API) mentioned here works on the business media list returned on above call.
Please note:
This still does not allow to fetch un-authenticated user's Instagram feed. That is not possible via API now. There is no valid way via API to get to public_content scope. There can be few Instagram Marketing partners for which this is enabled. But, in general the scope is deprecated now!
Currently, for FB graph API to work we need linked business page to Instagram account. As above apis uses page tokens.
You can get information about any IG business account using your FB access_token using the business_discovery API as given here.
You must have an IG business account to read other users data like user_info or media details using the id of your IG business account as a node.
Ex:
GET graph.facebook.com/[YOUR-IG-BUSINESS-ACCOUNT-ID]?fields=business_discovery.username(USERNAME){media{caption,media_url,media_type,like_count,comments_count,id}}

Access user's news feeds via Facebook Graph API

Pacific controls systems is developing a web application which includes gadget. we have a requirement to show a user's news feeds in a gadget. This requirement could be fulfilled with "me/home" Facebook API endpoint but this endpoint is deprecated right now.
Facebook API documentation redirect developers to use "me/feed" instead "me/home". To get access to user's news feeds we need "read_stream" permission. But according to Facebook support forum, this permission only be granted to apps which aims on platforms where Facebook is not already available.
Is there any workaround available to fulfill our requirement?.
read_stream does not exist anymore since a very long time. You can use user_posts instead, just keep in mind that you will not get all posts. Detailed information can be found in the changelog: https://developers.facebook.com/docs/apps/changelog#v2_3
Possible feed endpoints are listed in the API reference: https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed
Usage of user_posts has to get reviewed by Facebook before it can be used for users without a role in the App, it is called "Login Review": https://developers.facebook.com/docs/facebook-login/review

How much information can I access with facebook connect?

My google skills have failed.
My interest is how much user information I can access when having users connect to my website through. Comments, shared links, uploaded photos, data from other facebook applications used by the user?
Have a look at the Graph API ..or the old REST API for an idea of what you can access via Facebook APIs.
There's a good tutorial here: Facebook Connect Tutorial. I believe this article is using the REST API and the Javascript SDK for single sign on.