获取 IG 用户洞察 Facebook 图 API

GET IG User Insights Facebook Graph API

我正在尝试从 R 中的 Facebook Graph API 获取 IG 用户见解,但不幸的是我的脚本 returns 出错了。我尽力自己解决了这个问题,但没能解决。

我已经在我的脚本中尝试了其他指标,但出现了同样的问题。

access_token <- *[my user access token]*
user_id <- *[my IG user ID]*

insights <- GET("https://graph.facebook.com/",
                path = "me/insights/",
                query =list("metric" = "audience_city", "access_token" = access_token))
content(insights)

我需要有关我的受众的数据,但收到以下错误:

$error
$error$message
[1] "(#100) The value must be a valid insights metric"

$error$type
[1] "OAuthException"

$error$code
[1] 100

$error$fbtrace_id
[1] "xxxxxxxxxxxxxxxxxxx"

你不能在这里使用我 shorthand 因为它指的是代币而不是实际的 IG 账户。将 "me" 替换为实际的 IG user/account ID,它会正常工作。