FB Graph API - 尝试访问节点类型上不存在的字段(反应)(照片)
FB Graph API - Tried accessing nonexisting field (reactions) on node type (Photo)
我正在使用 FB Graph API 来获取喜欢或对我的 post 有反应的用户的姓名。通过使用
get/version/{post-id}/likes
我已经得到了所有点赞者的名字和ID。现在我也想得到其他反应,即 HAHA 或 Love 反应,但是当我使用 get/version/{post-id}/reactions
时,我得到这个错误
{
"error": {
"message": "(#100) Tried accessing nonexisting field (reactions) on node type (Photo)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Abwl9IBIxglskXT3yivpWUm"
}
}
有没有可能得到所有的反应?
用户将授权应用程序,所以这不是问题。
所以基本上等了3天,我没有得到任何答复。所以我决定 post 自己回答。这3天我发现的是,不可能得到所有的反应。喜欢和关心是您将获得的唯一数据。
如果我找到了解决所有问题的方法,我会更新答案。
可以通过请求此端点获得 post 上的所有反应(包括照片):
{user_id}_{post_id}?fields=
reactions.type(LOVE).limit(0).summary(total_count).as(love),
reactions.type(WOW).limit(0).summary(total_count).as(wow),
reactions.type(HAHA).limit(0).summary(total_count).as(haha),
reactions.type(LIKE).limit(0).summary(total_count).as(like),
reactions.type(ANGRY).limit(0).summary(total_count).as(angry),
reactions.type(SAD).limit(0).summary(total_count).as(sad)
(删除所有换行符,我放入它们只是为了使 URL 更具可读性)。
这个returns
{
"love": {
"data": [
],
"summary": {
"total_count": 50
}
},
"wow": {
"data": [
],
"summary": {
"total_count": 20
}
},
"haha": {
"data": [
],
"summary": {
"total_count": 24
}
},
"like": {
"data": [
],
"summary": {
"total_count": 60
}
},
"angry": {
"data": [
],
"summary": {
"total_count": 1
}
},
"sad": {
"data": [
],
"summary": {
"total_count": 1
}
},
"id": "{user_id}_{post_id}"
}
我从这个 post 得到了这个答案。
似乎 Facebook API 不支持使用 shorthand id 在照片上获取反应,但它支持使用普通 ID 获取反应,即 {user_id}_{post_id}
。
我正在使用 FB Graph API 来获取喜欢或对我的 post 有反应的用户的姓名。通过使用
get/version/{post-id}/likes
我已经得到了所有点赞者的名字和ID。现在我也想得到其他反应,即 HAHA 或 Love 反应,但是当我使用 get/version/{post-id}/reactions
时,我得到这个错误
{
"error": {
"message": "(#100) Tried accessing nonexisting field (reactions) on node type (Photo)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Abwl9IBIxglskXT3yivpWUm"
}
}
有没有可能得到所有的反应? 用户将授权应用程序,所以这不是问题。
所以基本上等了3天,我没有得到任何答复。所以我决定 post 自己回答。这3天我发现的是,不可能得到所有的反应。喜欢和关心是您将获得的唯一数据。
如果我找到了解决所有问题的方法,我会更新答案。
可以通过请求此端点获得 post 上的所有反应(包括照片):
{user_id}_{post_id}?fields=
reactions.type(LOVE).limit(0).summary(total_count).as(love),
reactions.type(WOW).limit(0).summary(total_count).as(wow),
reactions.type(HAHA).limit(0).summary(total_count).as(haha),
reactions.type(LIKE).limit(0).summary(total_count).as(like),
reactions.type(ANGRY).limit(0).summary(total_count).as(angry),
reactions.type(SAD).limit(0).summary(total_count).as(sad)
(删除所有换行符,我放入它们只是为了使 URL 更具可读性)。
这个returns
{
"love": {
"data": [
],
"summary": {
"total_count": 50
}
},
"wow": {
"data": [
],
"summary": {
"total_count": 20
}
},
"haha": {
"data": [
],
"summary": {
"total_count": 24
}
},
"like": {
"data": [
],
"summary": {
"total_count": 60
}
},
"angry": {
"data": [
],
"summary": {
"total_count": 1
}
},
"sad": {
"data": [
],
"summary": {
"total_count": 1
}
},
"id": "{user_id}_{post_id}"
}
我从这个 post 得到了这个答案。
似乎 Facebook API 不支持使用 shorthand id 在照片上获取反应,但它支持使用普通 ID 获取反应,即 {user_id}_{post_id}
。