1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Instagram Graph APIでネストしたInsightsを取得する方法

Posted at

概要

GET /{ig-user-id}/mediaで、合わせてinsightsを取得したい。
しかし以下のようなエラーが返ってくる。

GET /{ig-user-id}/media?fields=id,insights{impressions,engagement}

{
  "error": {
    "message": "(#100) For field 'insights': The parameter metric is required",
    "type": "OAuthException",
    "code": 100,
    "fbtrace_id": "xxxx"
  }
}

fields=id,insights{impressions}&metric=xxxなど色々試してみるがうまくいかない。
insightsを個々に叩けば取得はできるが、APIの制約等鑑みてバルクでネストしてとってきたい。

解決方法

fields=id,insights.metric(impression,engagement)として指定すると取得できる。

参考)https://codebug.vip/questions-3033537.htm

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?