Search code examples
facebook-graph-apiinstagram-graph-api

Instagram Graph API


My task is to get photo data of my business Instagram account with Instagram Graph API. I followed the instruction from Instagram Graph API - https://developers.facebook.com/docs/instagram-api/reference/user/media , which said request like

GET http://graph.facebook.com/17841405822304914/media

can get photo data from the Instagram account linked to the FB account in JSON format.

I tried to send GET request /my_facebook_id/media as said by the document with Graph API Explorer on FB developer platform but it failed to return the data I want. This is the error I got:

message: Tried accessing nonexisting field (media) on node type (User) type: OAuthException code: 100

Does the message mean the media field doesn't exist in the FB user?

What is the meanIng of error code 100? I can't even see that in FB official document.

I tried to use the Instagram business account ID for this request but I got an error message said the user object doesn't exist

How to get the task done? Thanks!


Solution

  • I guess you have missed creating a Facebook business page and linking your Instagram Business account to it.

    Here is the guide to setup : https://developers.facebook.com/docs/instagram-api/getting-started

    If this was done correctly and still you're facing the error is because of a Facebook bug where your account doesn't get linked correctly.

    Here : https://developers.facebook.com/support/bugs/177912116363088/?disable_redirect=0

    Solution : Please disconnect your Instagram account from your page. Then, on Instagram app, in setting you will have to switch back to personal account and reconvert to a business account

    Note : Switching to a personal account you will lose the insights of your media.

    Once this is done you should be able to get instagram_business_account and post which you can run your query to fetch the media :

    GET http://graph.facebook.com/you-instagram-business-account-id/media