Reputation: 6431
I am using official Facebook .NET SDK for publish music.listens action by below code.
var result = facebook.Post("me/music.listens", new
{
song = new
{
type = "music.song",
url = "www.example.com/blabla",
title = "Womanizer",
image = "www.example.com/blabla",
description = "Bu kısma açıklama gelecek",
musician = new
{
type = "profile",
title = "Britney Spears",
image = "www.example.com/blabla",
url = "www.example.com/blabla",
description = "Here is great song"
}
}
})
This code publish listen activity as below format.
"John listened to Womanizer on MySiteName."
But Pandora.com publish that activity with Artist information as below format.
"John listened to Womanizer by Britney Spears on Pandora."
This format is what i expected. It also shows tooltip on Artist name by showing Artist photo and with description. For that reason i passed musician information in parameters But Facebook looks ignore that parameter.
How can i represent music listen action as it is Pandora does or what is wrong on passed parameters ?
Upvotes: 0
Views: 191
Reputation: 56
I have not used the official .NET SDK to do what you are doing, however I have used direct HTTP POST calls to do this. The Facebook Open Graph requires a "reference object" for the song and musician objects instead of passing the data as parameters. These "reference objects" are just web pages with special meta-data.
In my situation I have a web server that hosts the song and musician meta-data in the Facebook Open Graph formats as described in their documentation. Then I made a me/music.listens post passing the url for the song and the url for the musician.
So instead of passing all the raw data as parameters, you need a web site which hosts all the meta-data.
If you look at the documentation here you will see some examples https://developers.facebook.com/docs/reference/opengraph/action-type/music.listens
If you go to http://samples.ogp.me/461258627226537 and view the source you can see a sample meta data for the song.
For example here is their php sample (sorry they don't have .NET samples)
/* make the API call */
$response = $facebook->api(
"/me/music.listens",
"POST",
array (
'song' => 'http://samples.ogp.me/461258627226537',
'musician' => 'http://samples.ogp.me/390580850990722',
)
);
/* handle the result */
Upvotes: 1