各种 Facebook API 页面“instagram”字段之间有什么区别

Chi*_*son 3 facebook facebook-graph-api instagram instagram-graph-api

如果用户查询 Facebook Graph API 的某个页面,则可以请求(至少)四个与 Instagram 相关的字段:

  1. connected_instagram_account - Instagram 帐户通过页面设置连接到页面
  2. instagram_business_account - Instagram 业务转换流程期间链接到页面的 Instagram 帐户
  3. instagram_accounts - 此页面的链接 Instagram 帐户
  4. page_backed_instagram_accounts - 此页面的链接页面支持的 Instagram 帐户

这些值可能会有很大差异,我可以破译其中的一些值,但 Facebook Graph API 文档对这些项目并不清楚。所以,我想知道是否有人已经或能够清楚地定义每一个并将其与另一个区分开来。

以下是一个页面的示例,该页面的四个字段具有 3 个不同的值(connected_instagram_account 和 instagram_business_account 相同):

-- instagram_accounts: #<Hashie::Mash data=#<Hashie::Array [#<Hashie::Mash id="...995">]>>
-- connected_instagram_account: #<Hashie::Mash id="...004">
-- instagram_business_account: #<Hashie::Mash id="...004">
-- page_backed_instagram_accounts: #<Hashie::Mash data=#<Hashie::Array [#<Hashie::Mash id="...234">]>
Run Code Online (Sandbox Code Playgroud)

我假设这是connect_instagram_account的定义,这是page_backed_instagram_accounts的定义。谁能确认这是正确的吗?

那么,instagram_accounts 又如何呢?

如果有人可以添加一些清晰度或更好的内容,指出好的定义,我们将不胜感激。

Chi*_*son 5

我想我对这个问题的大部分都有答案了...

如果我查询某个 Facebook 页面,它会返回所有四个 Instagram 字段的值:page_backed_instagram_accountsinstagram_business_accountinstagram_accountsconnected_instagram_account下面的部分显示了返回内容的编辑版本以及当我尝试使用Instagram API访问每个内容时会发生什么:

page_backed_instagram_accounts=#<Hashie::Mash data=#<Hashie::Array [#<Hashie::Mash id="964...289">]>
ERROR: "OAuthException: (#100) Tried accessing nonexisting field (biography) on node type (InstagramUser)"

instagram_business_account=#<Hashie::Mash id="178...143">
#<Hashie::Mash followers_count=X follows_count=Y ... username="<public handle>" website="https://www.../"> 

instagram_accounts=#<Hashie::Mash data=#<Hashie::Array [#<Hashie::Mash id="423...525">]>>
ERROR: "OAuthException: (#100) Tried accessing nonexisting field (biography) on node type (InstagramUser)"

connected_instagram_account=#<Hashie::Mash id="178...143">
#<Hashie::Mash followers_count=X follows_count=Y ... username="<public handle>" website="https://www.../">
Run Code Online (Sandbox Code Playgroud)

如您所见,Instagram API 可以访问instagram_business_accountconnected_instagram_account(在本例中是同一帐户),但不能访问page_backed_instagram_accountsinstagram_accounts

但是,如果我尝试根据Marketing API定义访问相同的帐户 ID,我会得到补充结果:

page_backed_instagram_accounts=#<Hashie::Mash data=#<Hashie::Array [#<Hashie::Mash id="964...289">]>
#<Hashie::Mash follow_count=0 followed_by_count=0 has_profile_picture=true id="964...289" is_private=false is_published=false media_count=0 profile_pic="https://scontent.cdninstagram.com/..._a.jpg?_nc_ht=scontent.cdninstagram.com" username="...758"> 

instagram_business_account=#<Hashie::Mash id="178...143">
ERROR: "OAuthException: (#100) Tried accessing nonexisting field (follow_count) on node type (ShadowIGUser)"

instagram_accounts=#<Hashie::Mash data=#<Hashie::Array [#<Hashie::Mash id="423...525">]>>
#<Hashie::Mash follow_count=J followed_by_count=K has_profile_picture=true id="423...525" is_private=false is_published=true media_count=1 profile_pic="https://scontent.xx.fbcdn.net/...a.jpg?_nc_cat=104&_nc_ht=scontent.xx&oh=d7ef...2dc&oe=5D0006BC" username="<public handle>"> 

connected_instagram_account=#<Hashie::Mash id="178...143">
ERROR: "OAuthException: (#100) Tried accessing nonexisting field (follow_count) on node type (ShadowIGUser)"

Run Code Online (Sandbox Code Playgroud)

正如您在第二个示例中看到的,Marketing API 可以访问page_backed_instagram_accountsinstagram_accounts,但不能访问instagram_business_accountconnected_instagram_account

因此,据我所知,page_backed_instagram_accountsinstagram_accounts是(营销 API)广告帐户,需要通过 [营销 API][3] 访问。

还有一些需要注意的事项:

  1. page_backed_instagram_accounts中的帐户似乎有一个自动生成的用户名,未发布 ( is_published=false)。
  2. 虽然instagram_accounts中的帐户与instagram_business_accountlinked_instagram_account中的帐户具有相同的用户名,但实际上它的 、 和 ID 略有followers_count不同follows_count
  3. Instagram API 根据节点类型进行报告InstagramUser,而 Marketing API 根据节点类型进行报告ShadowIGUser

我相信page_backed_instagram_accounts包含一个为所有帐户自动生成的广告帐户,以防万一没有其他广告帐户与 Instagram 帐户关联。尽管如此,如果能看到通过 Graph API 为 Facebook 页面返回的这些字段有一组更明确的定义,那就太好了。