3

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!

jrswgtr
  • 2,287
  • 8
  • 23
  • 49
anndexi99
  • 189
  • 3
  • 18

1 Answers1

3

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
Harshil Shah
  • 123
  • 5
  • I connected my instagram business account to my facebook page and tried to get the business account ID using GET graph.facebook.com/2179776668751697?fields=id,name,instagram_business_account{id,username,profile_picture_url} but I still cannot get the business account ID – Islam May 23 '19 at 14:08
  • 1
    I've given the solution above, disconnect your Instagram account from your page. On Instagram app, switch to personal account and then reconvert to business account and then again link it. You will be able to get the business account id. – Harshil Shah May 24 '19 at 12:56
  • I followed the steps as you mentioned in your answer and I cannot get the business account ID. – Islam May 25 '19 at 16:40
  • I followed the instructions above and also cannot get the business account ID. – Hennadii Kolomoiets Dec 02 '21 at 19:11
  • For a successful request you need to set in Instagram Graph API Explorer the permissions shown on the page https://developers.facebook.com/docs/instagram-api/reference/page/ – Hennadii Kolomoiets Dec 02 '21 at 19:41