0

I'm trying to add a tab to a fanpage using the graph api/PHP SDK and I'm receiving an error :

(#210) Subject must be a page

I've tried using both the user access_token AND the page access_token but neither work. I've tried using the page id of numerous accounts and still no go. Here is my code:

<?php

$path="/PAGE_ID/tabs/";
$access_token="ACCESS_TOKEN";
$params = array(
     'app_id' => "APP_ID",
     'access_token' => $access_token
);
try{
        $install = $facebook->api($path, "POST", $params);
}catch (FacebookApiException $o){
        print_r($o);
}
?>

And here is the error I get:

FacebookApiException Object
(
    [result:protected] => Array
        (
            [error] => Array
                (
                    [message] => (#210) Subject must be a page.
                    [type] => OAuthException
                )

       )

[message:protected] => (#210) Subject must be a page.
[string:Exception:private] => 
[code:protected] => 0

Thanks for any help you can provide!

Lix
  • 47,311
  • 12
  • 103
  • 131
dan
  • 11
  • 1
  • 2
  • it's 340394102638706. the page is published and strictly for testing. – dan Jan 30 '12 at 09:03
  • Is using the API a requirement or are you simply attempting to add your app to your page? – Lix Jan 30 '12 at 09:20
  • Any method of posting the tab to a fan page will do. I've only looked into the PHP SDK so far. Also, tried using URL requests but that didn't work either: "https://graph.facebook.com/PAGE_ID/tabs?method=POST&app_id=APP_ID&access_token=ACCESS_TOKEN" – dan Jan 30 '12 at 09:54
  • FB API is still bugged - you can't add an app to a fanpage via API-Call... here's the ticket. https://developers.connect.facebook.com/bugs/149252845187252?browse=search_4f31da351c4870e34879109 – Jurik Jun 11 '12 at 12:19

2 Answers2

0

API Call is atm bugged: https://developers.connect.facebook.com/bugs/149252845187252?browse=search_4f31da351c4870e34879109

But here is a solution for JS: OAuthException "(#210) Subject must be a page." - just do not use the library and do your own call.

I did it with PHP:

<?php
  $url = 'https://graph.facebook.com/<PAGE ID>/tabs?app_id=<APP ID>&method=POST&access_token=<PAGE ACCESS TOKEN>&callback=test';

  $ch = curl_init();
  curl_setopt($ch,CURLOPT_URL,$url);
  $result = curl_exec($ch);
  curl_close($ch);
  echo $result;
?>

Echo value should be something like "test(true)".

Community
  • 1
  • 1
Jurik
  • 3,244
  • 1
  • 31
  • 52
0

If you are not limited to using the API to add your application to your page then you can follow the instructions provided by Facebook at this link :
https://developers.facebook.com/docs/reference/dialogs/add_to_page/

Essentially you can use a dialog ( see the link above ) or this direct URL to add tab apps to your page :
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&display=popup&next=YOUR_URL

Dont forget to substitute APP_ID for your app id and next for a different URL

Lix
  • 47,311
  • 12
  • 103
  • 131
  • still working on this. the Direct URL method failed with error "An error occurred. Please try again later." going to try the javascript sdk next. – dan Feb 01 '12 at 00:24
  • have you configured your `page tab URL` and `secure page tab URL` ? – Lix Feb 01 '12 at 00:27
  • Yes. My other apps have similar settings and with the problem app I can still retrieve other info related to the manage_pages permission – dan Feb 01 '12 at 00:32