Search code examples
facebookfacebook-graph-api

Sharing Spotify link to Facebook and retrieving the link from graph api?


I have posted a link to a spotify track on my facebook account - something like this:

http://open.spotify.com/track/0aXxt38KBHHSmwNsHtIonU

Facebook appears to pick up the link (I get the track image and other data appearing in my feed)

But when I make a request to it via /me/feed in the graph api, there's no link or data relating to the track itself. All I get back is object that looks like this:

    ..{
  "id": "{{some_id}}", 
  "from": {
    "id": "{{my_id}}", 
    "name": "Si Davies"
  }, 
  "icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/y0/r/nAApRnfWfNW.gif", 
  "actions": [
    {
      "name": "Comment", 
      "link": "{{link to the post}}"
    }, 
    {
      "name": "Like", 
      "link": "{{link to the post}}"
    }
  ], 
  "privacy": {
    "description": "Public", 
    "value": "EVERYONE", 
    "friends": "", 
    "networks": "", 
    "allow": "", 
    "deny": ""
  }, 
  "type": "link", 
  "status_type": "shared_story", 
  "created_time": "2014-06-17T02:17:06+0000", 
  "updated_time": "2014-06-17T02:17:06+0000"
}...

Which isn't much use to me - I've tried specifying a link field with something like me/feed?fields=link and also mucked around granting various permissions with little or no effect.. how can I see what spotify track was added to my feed from the graph api?


Solution

  • Spotify seems to use the global music.listens Facebook OpenGraph action. Have a look at https://developers.facebook.com/docs/opengraph/music/

    You should be able to retrieve your data by issuing

    GET /me/music.listens
    

    according to the docs at https://developers.facebook.com/docs/reference/opengraph/action-type/music.listens#read Remember to grant the user_actions.music permission to be able to read the data (https://developers.facebook.com/docs/facebook-login/permissions/v2.0#reference-opengraph)