目前,我正试图为一次活动争取Facebook的RSVP,但我真的坚持了这一点:
正如我现在看到的,要获得用户的RSVP,我必须使用以下逻辑发出三个请求:
request eventID/attending/userID ->
if "data" array count == 0 ->
request eventID/maybe/userID ->
if "data" array count == 0 ->
request eventID/declined/userID
else -> means user didn't make any choice previously.在这里,看起来我必须向facebook的图形api发出3次请求,以获得用户对单个事件的RSVP。
问题是,对于执行单个请求的事件,是否有任何方法获得RSVP状态?
我正在使用最新的Facebook和最新的图形api。
在此之前,非常感谢您。
发布于 2015-12-12 14:22:26
因此,到目前为止,最好的解决方案是:
调用eventID/ filter (可能/拒绝)/userID允许我们将rsvp过滤到单个用户,因此我们避免了在这里下载和处理大量数据。
打完电话后,您有两个选择:
{ "data": [ { "name": "Oleskii Poplavlen", "id": "10204715567996406", "rsvp_status": "attending" } ]}
{ "data": [] }
因此,虽然您仍然需要发出多个请求才能使用户的RSVP事件发生,但您可以避免下载其他用户的RSVP。
希望这能帮到别人!
发布于 2015-11-30 00:53:58
我可以让你在两个电话里开始:
FB.api('/'+ event_id + '?fields=id,attending{rsvp_status},maybe{rsvp_status}', function(event_response){
// here you should make a call to check if the user has the event and if so get the rsvp_status
FB.api('/'+ user_id + '/events?fields=id,rsvp_status', function(user_response){
// check if user has event, then log the rsvp_status
if(user_response.id == event_response.id) {
console.log(user_response.rsvp_status);
} else {
console.log("user is not going");
});
});我还没有测试过这个API,但是我已经用这个API玩了很长时间了。这可能是一个答案,在两个电话,而不是在一个不幸的。
第一个电话不需要‘主治医生’和‘可能’字段,但它是有用的测试。
https://stackoverflow.com/questions/31173545
复制相似问题