Skip to content

Instantly share code, notes, and snippets.

@peter279k
Last active June 12, 2020 14:36
Show Gist options
  • Save peter279k/1c3ed14473b8055057d0213d759e92ed to your computer and use it in GitHub Desktop.
Save peter279k/1c3ed14473b8055057d0213d759e92ed to your computer and use it in GitHub Desktop.
This is an Instagram API doc reference with organized stuffs.

Legacy API Platform

March 30, 2020 Update: We understand these are challenging times for our developer community, so we are postponing disabling the Instagram > Legacy API Platform by 90 days to June 29, 2020. Remaining endpoints on the Legacy API will no longer be available after this date and your app's users may lose functionality.

Instagram Graph API (Only for business process usage)

  • https://developers.facebook.com/docs/instagram-api/
  • The API is intended for Instagram Businesses and Creators who need insight into, and full control over, all of their social media interactions.
  • If you are building an app for consumers or you only need to get an app user's basic profile information, photos, and videos, consider the Instagram Basic Display API instead.
  • The API cannot access Intagram consumer accounts (i.e., non-Business or non-Creator Instagram accounts).
  • If you are building an app for consumer users, use the Instagram Basic Display API instead.

Instagram Basic Display API (It's proper for our purpose)

  • https://developers.facebook.com/docs/instagram-basic-display-api
  • The Instagram Basic Display API allows users of your app to get basic profile information, photos, and videos in their Instagram accounts.
  • The API can be used to access any type of Instagram account but only provides read-access to basic data.
  • If you are building an app that will allow Instagram Businesses or Creators to publish media, moderate comments, identify @mentioned and hashtagged media, or get data about other Instagram users, use the Instagram Graph API instead.

Common uses for Instageam Basic Display API

  • Get an Instagram User Access Token and permissions from an Instagram user
  • Get an Instagram user’s profile
  • Get an Instagram user’s images, videos, and albums

Authentication for Instageam Basic Display API

  • Instagram Basic Display is not an authentication solution.
  • Data returned by the API cannot be used to authenticate your app users or log them into your app.
  • If you need an authentication solution we recommend using Facebook Login instead.

Legacy IDs

  • Instagram Legacy API User IDs are incompatible with the Instagram Basic Display API.
  • If you are migrating to the Basic Display API and need to map a user's Basic Display ID to their corresponding Legacy ID, request the ig_id field on the User node.
  • The ig_id field will return the user's Legacy ID until September 30th, 2020, when it will be deprecated.

Media

  • Stories are not supported.(限時動態)
  • Comments are not supported.(留言)
  • Insights are not supported. (洞察報告) 參考:https://help.instagram.com/1533933820244654
  • Promoted posts containing Instagram media are not supported. (穿插的贊助廣告文 以及其含有的Media, GIF 圖片等)

Overview for Instageam Basic Display API

  • The Instagram Basic Display API is an HTTP-based API that apps can use to get an Instagram user’s profile, images, videos, and albums.

Instageam Basic Display API Endpoints

  • api.instagram.com — for getting Instagram User Access Tokens
  • graph.instagram.com — for getting Instagram user profiles and media

Authorization Codes for Instageam Basic Display API

  • The authorization is only exchanged for short-lived Instagram User Access Tokens.
  • To get an authorization code, implement the Authorization Window into your app.
  • After an app user authenticates their identity through the window, we will redirect the user to your app an include an Authorization Code.
  • You can then use the API to exchange the code for the Instagram user’s app-scoped short-lived Instagram User Access Token.

Short-Lived Access Tokens for Instageam Basic Display API

  • Short-lived access tokens are valid for 1 hour, but can be exchanged for long-lived tokens.
  • To get a short-lived access token, implement the Authorization Window into your app.
  • After the app user authenticates their identity through the window, we will redirect the user back to your app and include an Authorization Code, which you can then exchange for a short-lived access token.

Long-Lived Access Tokens for Instageam Basic Display API

  • Long-lived tokens are valid for 60 days and can be refreshed before they expire.
  • Short-lived access tokens can be exchanged for long-lived access tokens through the GET /access_token endpoint.
  • Once you have a long-lived access token you can refresh it before it expires through the GET /refresh_access_token endpoint.

Permissions for Instageam Basic Display API

  • Data access authorization is controlled by your app users through the use of the permissions listed below.
  • Users must grant your app these permissions through the Authorization Window before your app can access their data.

instagram_graph_user_profile — allows your app to read the User node, which represents the Instagram user, and the node’s edges.

instagram_graph_user_media — allows your app to read the Media node, which represents an image, video, or album, and the node’s edges.

  • All permissions need to be approved for your app through the App Review process before they can be used in Live Mode

Authorization Window for Instageam Basic Display API

  • The Authorization Window allows your app to get short-lived Instagram User Access Tokens
  • And permissions from Instagram users in order to access data in their Instagram accounts.
  • To implement the Authorization Window, refer to our Getting Access Tokens guide.

alt img

Rate Limits for Instageam Basic Display API

  • All endpoint requests are subject to Graph API’s Platform Rate Limiting.
  • You can see your app's current call count consumption in the App Dashboard > Instagram > Basic Display Rate Limiting tab after adding the Instagram product to your app.

Create Instagram Test App

  • Create Facebook App

alt_img

  • Add a Instagram Product

alt_img

  • Select Basic Display Tab

alt_img

  • Alert for Creatung Instagram App

alt_img

  • Add platform on Settings -> Basic firstly

alt_img

alt_img

alt_img

  • Create a Instagram App ID

alt_img

alt_img

alt_img

  • User Token Generator Tool

alt_img

  • App Review for Instagram Basic Display on production

alt_img

  • Add Instgram Test Users

alt_img

alt_img

alt_img

alt_img

alt_img

alt_img

alt_img

Tools for Instageam Basic Display API

  • It's not available for Instageam Basic Display API
  • The graph API explorer for Instageam Business API

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment