user984621
user984621

Reputation: 48443

How to correctly publish Open Graph action?

I am trying to publish my Open Graph action to the wall. All meta tags are set up, but I don't know, which parameter I should add to this command:

$facebook->api('/me/APP_URL_NAME:action_name','POST', array('image'=>$meta_shoe_image));

returns:

Fatal error: Uncaught Exception: The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: OBJECT_NAME. thrown in _FB_LIBRARY_

when I try

$facebook->api('/me/APP_URL_NAME:action_name','POST', array('OBJECT_NAME'=>'http://apps.facebook.com/APP_URL_NAME:action_name', 'image'=>$meta_shoe_image));

which returns

Fatal error: Uncaught OAuthException: (#3502) Object at URL http://apps.facebook.com/APP_URL_NAME/ has og:type of 'website'. The property 'shoe' requires an object of og:type 'APP_URL_NAME:OBJECT_NAME'. thrown in _PATH_TO_FB_LIBRARY_

What am I doing still wrong? Where can I get, what should be 'OBJECT_NAME'=>'_HERE_'?

EDIT: Also, when I try to obtain current URL address and push it into the Facebook function:

function curPageURL() {
 $pageURL = 'http://';
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
$facebook->api('/me/APP_URL_NAME:action_name','post', array('OBJECT_NAME' => curPageURL(), 'image' => $meta_shoe_image));

I get

Fatal error: Uncaught Exception: Could not retrieve data from URL. thrown in _FB_FILE_

Upvotes: 0

Views: 1302

Answers (1)

C3roe
C3roe

Reputation: 96241

Fatal error: Uncaught OAuthException: (#3502) Object at URL http://apps.facebook.com/APP_URL_NAME/ has og:type of 'website'. The property 'shoe' requires an object of og:type 'APP_URL_NAME:OBJECT_NAME'. thrown in _PATH_TO_FB_LIBRARY_

That sounds like you are trying to use your app’s canvas page URL on Facebook as the Open Graph object you are trying to publish an action upon.

You can’t do that – it has to be a “stand-alone” web page, and it has to have it’s og:type set up in the meta tags as 'APP_URL_NAME:OBJECT_NAME'.

Upvotes: 1

Related Questions