Topic-icon Deleting a tab from a page

Active Subscriptions:

None
13 years 8 months ago #26489 by rodaro
Hello!
Im trying to delete a tab from a page, and im using something like this
$removed = $jfbcLibrary->api($page_id."/tabs/".$app_id,null,false,"DELETE");

it returns me an empty array

if I try $removed = $jfbcLibrary->api($page_id."/tabs/".$app_id,"DELETE");

I have an error on the code of JFB

so which is the correct way of making DELETE requests using JFB?

please let me know.

Regards
The topic has been locked.
Support Specialist
13 years 8 months ago #26507 by alzander
Replied by alzander on topic Deleting a tab from a page
The definition for the api method is different than you're using. It's format looks like:
function api($api, $params = null, $callAsUser = true, $method = null, $suppressErrors = false)
So, I think you'd want to make your call like:
$removed = $jfbcLibrary->api($page_id."/tabs/".$app_id, null, false, "DELETE");

I'm assuming you need to be able to do the delete programmatically. If not, deleting the Page Tab manually on your actual Page is a pretty simple process.

Finally, the api call is a little ugly right now. For the 5.0 release (coming out late this year or early next), we're planning to simplify that function a little. Just want to point that out so that any changes you make now, you know to re-check when 5.0 is out and you upgrade.

Best of luck,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 8 months ago #26532 by rodaro
Replied by rodaro on topic Deleting a tab from a page
Hello
This is always returning NULL for me.. :S
is thereIm doing this
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$removed = $jfbcLibrary->api($page_id."/tabs/".$app_id, null, false, "DELETE");
var_dump($removed);die();

And always having NULL
you seee anything bad on this? DO I have to send page access token?

Thanks & Regards
The topic has been locked.
Support Specialist
13 years 8 months ago #26536 by alzander
Replied by alzander on topic Deleting a tab from a page
Rodrigo,
Never dealt with deleting pages before, so I had to do some research. Yes, you'll need to send a Page Access Token to delete the page, since FB needs to ensure the Page really wants to delete the tab. The code I sent above will send the App access token, which, now that I think about it, wouldn't be right.

So, you'll need to get the Page Access Token, and then try the following code:
$params['access_token'] = $pageAccessToken;
$removed = $jfbcLibrary->api($page_id."/tabs/".$app_id, null, true, "DELETE");
Note that the $callAsUser parameter was false, but is now true. That's to get around a forced setting in the function for the access token (another reason why we'll be changing the function in the next major release).

For information on how to get a Page Access Token, please see the page below:
developers.facebook.com/docs/reference/a.../#page_access_tokens

Page Access Tokens are, again, something I really haven't dealt much with, so hopefully you already have this or know how to get programmatically. Doesn't look too difficult, but not sure how you're trying to push this into JFBConnect.

Thanks,
Alex
The topic has been locked.