您可以使用包含 Facebook 登录的 Instagram API 获取其他 Instagram 专业账户的基本元数据及指标。
如果 Instagram 专业账户设有年龄限制,则系统不会返回其相关数据。
此 API 包含以下端点。如需了解参数和权限要求,请参阅端点的参考文档。
此查询示例显示如何获取 Blue Bottle Coffee Instagram 专业账户的粉丝量和已发布媒体对象量。请注意,尝试获取您应用用户 Instagram 专业账户的相关数据时,执行商家发现查询需要使用该用户 Instagram 专业账户的编号(在此示例中为 17841405309211844)和账号(在此示例中为 bluebottle)。
为方便阅读,示例格式已经过调整。
curl -i -X GET \
"https://graph.facebook.com/v25.0/17841405309211844 \
?fields=business_discovery.username(bluebottle){followers_count,media_count} \
&access_token=<YOUR_APP_USERS_INSTAGRAM_USER_ACCESS_TOKEN>"
{
"business_discovery": {
"followers_count": 267793,
"media_count": 1205,
"id": "17841401441775531" // Blue Bottle's Instagram user ID
},
"id": "17841405309211844" // Your app user's Instagram user ID
}您可以通过 fields 参数指定连线来发出嵌套请求,因此可以请求目标专业账户的 media 连线,以获取其已发布的所有媒体对象。
为方便阅读,示例格式已经过调整。
curl -i -X GET \
"https://graph.facebook.com/v25.0/17841405309211844 \
?fields=business_discovery.username(bluebottle){followers_count,media_count,media} \
&access_token=<YOUR_APP_USERS_INSTAGRAM_USER_ACCESS_TOKEN>"
{
"business_discovery": {
"followers_count": 267793,
"media_count": 1205,
"media": {
"data": [
{
"id": "17858843269216389"
},
{
"id": "17894036119131554"
},
{
"id": "17894449363137701"
},
{
"id": "17844278716241265"
},
... // results truncated for brevity
],
"id": "17841401441775531"
},
},
"id": "17841405309211844"
}您可以同时使用嵌套请求和字段扩展来获取业务账户或创作者账户媒体对象的公开字段。请注意,此操作不会授予您直接访问媒体对象的权限;由于权限不足,对返回的任何 Instagram 媒体执行 GET 均会失败。
以下示例说明如何获取 Blue Bottle Coffee 发布的每个媒体对象的评论数和赞数:
请注意,view_count 包括付费指标和自然指标
GET graph.facebook.com
/17841405309211844
?fields=business_discovery.username(bluebottle){media{comments_count,like_count,view_count}}{
"business_discovery": {
"media": {
"data": [
{
"comments_count": 50,
"like_count": 5837,
"view_count": 7757,
"id": "17858843269216389"
},
{
"comments_count": 11,
"like_count": 2997,
"id": "17894036119131554"
},
{
"comments_count": 28,
"like_count": 3643,
"id": "17894449363137701"
},
{
"comments_count": 43,
"like_count": 4943,
"id": "17844278716241265"
},
],
},
"id": "17841401441775531"
},
"id": "17841405976406927"
}