Guy Sopher
Guy Sopher

Reputation: 4460

Update / Delete a tab from a facebook page using the Graph API returns "(#210) Subject must be a page."

I am trying to delete an application tab from a facebook page. According to the documentation, I should issue a DELETE request to "https://graph.facebook.com/PAGE_ID/tabs/TAB_ID" with a PAGE access token, but when I do so I get the error "(#210) Subject must be a page." The same happens when trying to update a tab. I have requested the user for "manage_pages" permission and I have the correct access_token (Adding a tab works perfectly). the exact request is: https://graph.facebook.com/212757048770606/tabs/app_289329597785433 (with an access token)

Does anyone know what am I doing wrong?? or is there an open bug report?

Thanks alot

Upvotes: 1

Views: 1410

Answers (3)

Shrikant C Dube
Shrikant C Dube

Reputation: 1

  function DeleteTabPage(){  
        var pid = page_id;
        var at = access_tocken;           
        debugger;
        FB.api(pid + '/tabs/app_{your app id}', 'DELETE', { app_id: your app id, access_token: at }, function (response) {
            debugger;
            if (!response || response.error) {
                debugger;`enter code here`
                alert('Facebook add app error ' + response.error);
            } else {
                console.log(response);
                debugger;
                //  alert('App has been added');
            }
        }); /* end of page/tabs*/
    }

Upvotes: 0

user3767385
user3767385

Reputation: 1

Add the page access token to the call of Facebook API

var PageAccessToken = 123456789123456789123456789123456789;
FB.api(
    "/{page_id}/tabs",
    "POST",
    {
        "object": {
            "app_id": "{page_id}"
        }
    },{
    "access_token": PageAccessToken
    },
    function (response) {
      if (response && !response.error) {
        console.log(response);
      } else {
        console.log(response.error);
      }
    }
);

Upvotes: 0

jfrank
jfrank

Reputation: 733

I don't have a solution for you, but I do know that I had some problems with removing a tab that boiled down to the fact that the tab's ID (returned from a call to get /PAGE_ID/tabs) already includes the page ID and "tabs" path.

Initially I was building my URL by taking the tab ID and sticking it on the end of /PAGE_ID/tabs/, but that didn't work because the URL ended up being something like /12345/tabs/12345/tabs/app_4567. Once I realized that the tab ID was sort of "compound" already, I got the Remove to work.

Upvotes: 1

Related Questions