Question

I am trying to post a message through apis on facebook wall. The problem is it appears differently when i post via api then when i directly paste a link as facebook status. I am not sure if i am doing something wrong. Please advise.

The link i want to post as an example is http://commondatastorage.googleapis.com/blood/2415012_26-May-2012

The code i am using is something like:

FacebookType publishMessageResponse =                             facebookClient.publish("me/feed", FacebookType.class,
Parameter.with("name", "Click here to Register as a Blood Donor"),
Parameter.with("picture", "http://commondatastorage.googleapis.com/blood/2415012_26-May-2012"),
Parameter.with("link", "http://links.sakshum.org/RegisterBloodDonor"),
Parameter.with("description", "Sakshum is a not for profit organization working in the field of child education and building an effective blood donor pool."));
Était-ce utile?

La solution

Because when you paste directly Facebook tries to infer the meta OG tags.

See the debugger for more information http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fcommondatastorage.googleapis.com%2Fblood%2F2415012_26-May-2012

Inferred Property: The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.

Inferred Property: The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.

Inferred Property: The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags. ... etc

Set your meta tags in the <head> section of the url and you wouldn't have to set it.

And in your <head>

<meta property="og:url" content="http://commondatastorage.googleapis.com/blood/2415012_26-May-2012">
<meta property="og:title" content="Click here to Register as a Blood Donor">
<meta property="og:description" content="Sakshum is a not for profit organization working in the field of child education and building an effective blood donor pool.">
<meta property="og:image" content="http://YOURURL.COM/LINKTOIMG.jpg">

For more information on feed see http://developers.facebook.com/docs/reference/api/user/#posts

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top