Sharing to Facebook, Twitter etc

It is now possible to share all public tracks and playlists to the connections of the authenticated user. So if a user is already connected e.g. with Facebook on SoundCloud, this connection can be used from your app to share a track.

The general flow for sharing looks like this:

  1. Get the connections of the user

    $ curl -H "Authorization: OAuth {access_token}" "https://api.soundcloud.com/me/connections"
    
    [
      {
        "id": 1234,
        "created_at": "2010/12/14 22:02:07 +0000",
        "display_name": "My Facebook Name",
        ...
        "service": "facebook_profile",
      },
    ]
  2. Choose connections

    Display the connections to the user and let her choose to which social networks she wants to post to. Remember the ids of the connections for the next step. You can also enable the user to connect to new social networks. This is explained further in the connections documentation. Furthermore the user can enter a custom sharing message.

  3. Post to connections

    In this example we will post the track with the id 321 with the message “I love this track” to the Facebook profile 1234:

    $ curl -H "Authorization: OAuth {access_token}" "https://api.soundcloud.com/tracks/321/shared-to/connections" \
      -d connections[][id]=1234 \
      -d sharing_note=I+love+this+track

You can both post your own and other peoples track via this resource. If you want to know more, read the documentation for track here and for playlists here.