是否可以在单个 API 调用中请求不同时期的 Instagram 指标?
Is it possible to request Instagram metrics with different periods in a single API call?
我想使用单个图表 API 调用请求以下 Instagram Insights 指标:
- follower_count
- audience_gender_age
我面临的问题是 follower_count
需要周期参数 'day',audience_gender_age
需要周期参数 'lifetime'。我试图将它们合并到一个 API 调用中,但这不受 Facebook 支持:
/XXXXXX/?fields=insights.metric(follower_count).period(day),insights.metric(audience_gender_age).period(lifetime)
我有正确的方法在单个 API 调用中使用不同的时间段来请求这些指标吗?
如果您需要在一次查询中两次从同一字段请求数据,可以使用 .as(name)
别名语法 https://developers.facebook.com/docs/graph-api/aliasing-fields
来完成
引用文档,
For example, you can retrieve an image in two sizes and alias the returned object fields as picture_small and picture_larger:
me?fields=id,name,picture.width(100).height(100).as(picture_small),
picture.width(720).height(720).as(picture_large)
我想使用单个图表 API 调用请求以下 Instagram Insights 指标:
- follower_count
- audience_gender_age
我面临的问题是 follower_count
需要周期参数 'day',audience_gender_age
需要周期参数 'lifetime'。我试图将它们合并到一个 API 调用中,但这不受 Facebook 支持:
/XXXXXX/?fields=insights.metric(follower_count).period(day),insights.metric(audience_gender_age).period(lifetime)
我有正确的方法在单个 API 调用中使用不同的时间段来请求这些指标吗?
如果您需要在一次查询中两次从同一字段请求数据,可以使用 .as(name)
别名语法 https://developers.facebook.com/docs/graph-api/aliasing-fields
引用文档,
For example, you can retrieve an image in two sizes and alias the returned object fields as picture_small and picture_larger:
me?fields=id,name,picture.width(100).height(100).as(picture_small), picture.width(720).height(720).as(picture_large)