0

I am able to fetch the list of media objects associated with an external user using the following URL

GET (my IG user id)?fields=business_discovery.username(therock){media{caption,children,comments_count,like_count,id,media_type,media_url,owner,timestamp,username}}

How do I fetch the Insights of an external user using the above method. I do know to fetch the insights of my own account using the following URL

GET (my IG user id)/insights?metric=impressions&period=week

When I try to fetch the insights using the URL below

GET (my IG user id)?fields=business_discovery.username(therock){insights}}

the following error is thrown

{
  "error": {
  "message": "Syntax error \"Expected end of string instead of \"}\".\" at     character 46: business_discovery.username(therock){insights}}",
  "type": "OAuthException",
  "code": 2500,
  "fbtrace_id": "FeWhDF4hOJY"
  }
}

Is it possible to fetch the insights of an external account?

Rahul Vijay
  • 31
  • 1
  • 2
  • 7

2 Answers2

2

To retrieve insights from a FB page you have to provide credentials from one of the page admins. If you have them, you don't need to use the business_discovery endpoint. If you don't have them, you cannot retrieve insights.

javi
  • 21
  • 5
0
GET (my IG user id)?fields=business_discovery.username(therock){insights}}

Looks like you simply left an extra } there at the end - remove the superfluous one, then the error should be gone.

(With {media{...}} you had two levels of nesting, but now you have only one.)

04FS
  • 5,660
  • 2
  • 10
  • 21
  • Thanks for pointing that out. After removing the extra bracket, I get the following error "(#10) Application does not have permission for this action". I have selected all permissions available in the explorer. Do you have an idea as to what permission is required and how to obtain it? – Rahul Vijay Jan 23 '19 at 17:12
  • 1
    According to documentation you need to supply at least `metric` and `period` parameters - sometimes missing parameters can cause errors that don’t seem directly related or accurate, so try if adding those changes things. https://developers.facebook.com/docs/instagram-api/reference/user/insights – 04FS Jan 24 '19 at 07:19