Facebook Requests ID(s) retrieve and delete

倾然丶 夕夏残阳落幕 提交于 2020-01-03 04:42:08

问题


So I'm developing a small web app, that implements the Requests Dialog(User-to-User).

I'm able to send an invite and also successfully to save data as request id and user id. But when the user gets redirected to my app, after clicking on the request, i can't retrieve request id as shown here: https://developers.facebook.com/docs/requests/#deleting and then delete it.

But i see the request id in the address bar of the browser and it looks like this: http://apps.facebook.com/myownapp/?fb_source=request&request_ids=210655195715938 and REQUEST_URI is: /halten/?fb_source=request&request_ids=210655195715938

i tried with javascript:

function getMultipleRequests(requestIds) {
    FB.api('', {
        "ids": requestIds
    }, function(response) {
        console.log(response);
    });
}​

or with php:

if(isset($_REQUEST['request_ids'])) {
    $requestIDs = explode(',' , $_REQUEST['request_ids']);
    foreach($requestIDs as $requestID) {
      try {
        $delete_success = $facebook->api('/' . $requestID, 'DELETE');
      } catch(FacebookAPIException $e) {
        error_log($e);
      }
    }

but the request_ids is always empty but my browser shows the request_id

So the question is how to handle the problem? Thanks in advance


回答1:


A User to User Request is actually notified to the user in 4 levels.

1) Jewel notification

2) Bookmarks counter

3) Right top counter

4) Weird location notification inside the app(I did not know what this was called sorry)

All of these request will take the user to the app but unfortunately on the Jewel notification(#1) request url will contain all the request IDs and the remaining will contain only a single request ID.

Say you send 4 requests (1,2,3,4)

#1 in url will have 1&2&3&4

#2,#3,#4 will have one of those depending on which notification you response to

Hope this makes sense and answers the question.



来源:https://stackoverflow.com/questions/10226640/facebook-requests-ids-retrieve-and-delete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!