Instagram API

sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
edited June 2019 in Knowledge Base
instagran.png

Hi all - had a nice phone call today from a new user who wanted to pull information from Instagram. I suggested looking at their API (of course). Turns out that Instagram is transitioning to Facebook Graph API (as they just bought Instagram) so until our good friends at Aptus Data Labs can get Instagram Graph API with OAuth going for us (hint, hint), here's a quick hack:

 

Goal: get hashtag counts on instagram

 

Step 1: get an Instagram API access token (nice easy steps here).

Step 2: create a document with hashtags

Step 3: run this process (see attached for code)

 

Screen Shot 2017-12-28 at 4.51.01 PM.png

 

You should see a series of results that look like this:

 

Screen Shot 2017-12-28 at 5.01.36 PM.png

 

A full list of Instagram REST API endpoints can be found here.

 

Enjoy!

 

Scott

 

Comments

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    I had to get a token in a very arduous round about way instead via the link you shared. It seems that Instagram is making a lot of API changes and a lot of things are being deprecated and breaking. I suspect that this is because they are moving to FB's open graph protocol. 

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    yes I had to go through the same rigmarole and agree it must be due to migration to FB graph. Sigh.

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    hi...this just in from the folks at Instagram:

     

    We wanted to inform you of upcoming API changes that affect Instagram's two public APIs. Starting July 31, 2018 we will begin deprecating the older Instagram API Platformwith complete deprecation occurring by early 2020 - please see a detailed timeline below. We understand that this may affect your business or services so we want to ensure a smooth transition by informing you of these changes.

    If your application supports Instagram business profile users, we encourage you to begin building on the Instagram Graph API (launched to all developers in August 2017) if you have not done so already. We are excited to share that, starting on 1/30, two new features are available to all developers on the Instagram Graph API - more details below.

     

    Instagram API Platform: Full Deprecation Schedule

    The following will be deprecated on July 31, 2018:

    • Follower List - to read the list of followers and followed-by users
    • Relationships - to follow and unfollow accounts on a user’s behalf
    • Commenting on Public Content - to post and delete comments on a user’s behalf on public media

     

    The following will be deprecated on December 11, 2018:

    • Commenting - to post and delete comments on a user’s behalf on owned media
    • Public Content - to read any public profile info and media on a user’s behalf
    • Likes - to like and unlike media on a user’s behalf
    • Subscriptions - to receive notifications when media is posted

     

    The following will be deprecated in early 2020:

    • Basic - to read a user’s profile info and media

     

    Instagram Graph API: Launches

    The following features are now available for Instagram business profiles to all developers:

    1. Business Discovery [NEW] - Discover and read the profile info and media of other business profiles.
    2. Mentions [NEW] - Read public media that a business has been photo tagged or @mentioned in. Post comments on a business' behalf on media it was tagged or mentioned in.
    3. Insights - Help businesses access and analyze valuable metrics about their Instagram business profile. Enable them to understand and optimize the performance of their organic content on Instagram.
    4. Comment Moderation - Drive interactions at scale. Enable businesses to more efficiently interact with their audience through comments under their media on Instagram.
    5. Support for Non-Business Profiles [FUTURE]: Basic permissioning for non-business profiles will be supported in early 2019.

     

    To find out more about the new Instagram Graph API features, check out the documentation.

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    THe API is breaking but I might have found a solution using https://www.instagram.com/explore/tags/{HASHTAG}/?__a=1

     

    The __a=1 part of the URL responds with a JSON array a lot faster and without authentification. I will have to investigate. 

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    And you have to update the JSONPath in the Enrich with Web Service operator by adding this: 

     

    $..edge_hashtag_to_media.count

     

     

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    thank you @Thomas_Ott - I was wondering when the Instagram API would completely melt down. Thanks for the workarounds!

  • Robi_MeRobi_Me Member Posts: 32 Maven
    edited January 2021
    I managed to get this to work, without having to go through the API. There is the ability to search accounts and trends. I will post the process below of all of the fields available for others to copy in need. 
  • Robi_MeRobi_Me Member Posts: 32 Maven
    edited January 2021
    .
Sign In or Register to comment.