Adam Templeton
Adam Templeton

Reputation: 4617

Deleting a Request on a Facebook app

I'm brand new to Facebook development, and I'm puzzling over the FB Requests documentation, wherein it claims:

"When a user is directed to your app by clicking accepting a Request you must delete the request after it has been accepted."

Quite frankly I have no idea what they're talking about.

How can I find my outstanding requests? What's the best way to go about deleting them (I'm using the Javascript SDK)? Are there any dire consequences to not deleting requests?

Upvotes: 1

Views: 1018

Answers (1)

Igy
Igy

Reputation: 43816

Yes you must delete the requests, and the very next part of the documentation after the line you quoted explains how to do this with a direct API call, a javascript SDK example and a PHP example:

You can delete a request via the following methods:

 

Deleting Requests

When a user is directed to your app by clicking accepting a Request you must delete the request after it has been accepted. Requests are not automatically deleted once they have been clicked, thus it is the developer’s responsibility to clear them once they have been accepted.

You can delete a request via the following methods:

Graph API

Issue an HTTP DELETE request to the concatenated request_id:

DELETE https://graph.facebook.com/[<REQUEST_OBJECT_ID>_<USER_ID>]?
      access_token=[USER or APP ACCESS TOKEN]

JavaScript SDK

function deleteRequest(requestId) {
  FB.api(requestId, 'delete', function(response) {
    console.log(response);
  });
}

Here is a full PHP sample which shows you how to concatenate the request_id and user_id in order to delete the outstanding requests for a user.\

//snipped the big PHP sample

Upvotes: 1

Related Questions