Henri Korpela
Henri Korpela

Reputation: 111

Facebook Graph API, v3.2 - How to get user media for an Instagram account (3.6.2019)?

I am working on Instagram API integration to our service. As of 3.6.2019, I have tried to get media for a particular Instagram user account. I have tried to understand the documentation, and this is what I have working so far:

  • email
  • instagram_basic
  • manage_pages
  • pages_show_list
  • pages_messaging
  • public_profile

What perplexes me about this is that when I read the documentation, user info retrieval seems to work alright:

enter image description here

However, if I changed the URL to match the media retrieval URL and keeping the same user ID, I get the following error

enter image description here

even through the documentation says:

To get all media objects on an Instagram Business User, send a GET request to the User's /media edge.

And the sample request URL provided:

GET graph.facebook.com/17841405822304914/media

Source: https://developers.facebook.com/docs/instagram-api/reference/user/media/

What am I doing wrong? The URL seems to follow the documentation description. I did use the user access token for the media request. The access token contains permission for instagram_basic, as needed based on the documentation:

Permissions

An access token from the Instagram Business User, with the following permissions:

  • instagram_basic

I am using API version 3.2.

Upvotes: 0

Views: 1618

Answers (1)

Jannik
Jannik

Reputation: 61

Do you really use the right instagram id? Try calling this API with the ID you used: https://graph.facebook.com/v5.0/[ENTER_ID]?fields=instagram_business_account{id, username,profile_picture_url}&access_token={}

I you get a result like this:

{
    "instagram_business_account": {
        "id": "XXXXXXX",
        "username": "XXXX",
        "profile_picture_url": "https://scontent.xx.fbcdn.net/v/t51.2885-15/44644278_733652060347074_11957"
    },
    "id": "XXXXXXX"
}

You know, that you used the wrong ID :D Go ahead and call the /media endpoint with the ID nested under instagram_business_account

Upvotes: 1

Related Questions