Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access a user's stream?

Tags:

soundcloud

new to the SoundCloud API.

Say I am a registered user. I upload a couple of tracks and they appear on my page when I log into soundcloud at: https://soundcloud.com/stream

Using the API, I can now access data re my uploaded tracks.

If I then follow other users, these users' tracks will also appear at https://soundcloud.com/stream. However, I could not find in the API Docs any way to access data for my tracks + tracks of users I follow. Any way to do this ?

like image 511
Running Turtle Avatar asked Dec 31 '12 14:12

Running Turtle


1 Answers

It seems the SoundCloud documentation got updated: the user's activities, quoted as being "the items on the logged in user's dashboard" can be fetched. You can even get specific types of items on this Dashboard.

When you process a GET request with this URL $ curl 'https://api.soundcloud.com/me/activities?limit=1&oauth_token=A_VALID_TOKEN', you have a JSON or XML file (see at the bottom of the answer) that contains the informations you requested. In this URL, you can replace /me/activities by these expressions:

/me/activities gives you user's recent activities
/me/activities/all is the same as the one above (Recent activities) /me/activities/tracks/affiliated is the recent tracks from users the logged-in user follows (the stream)
/me/activities/tracks/exclusive is recent exclusively shared tracks
/me/activities/all/own is recent activities on the logged-in users tracks

JSON responses follow this scheme:

{
  "next_href": "https://api.soundcloud.com/...?cursor=81923e19...",
  "collection": [
    {
      "type":       "comment",
      "created_at": "2011/07/21 09:55:19 +0000",
      "tags":       "own, affiliated",
      "origin": {
        ...
      }
    },
    ...
   ]
}

XML responses follow this one:

<?xml version="1.0" encoding="UTF-8"?>
<activities next-href="https://api.soundcloud.com/me/activities?cursor=0fc02662-1d76-11e0-8c9a-48ea6afb1384" type="array">
  <activity>
    ...
  </activity>
  ...
</activities>

For deeper and more precise informations about this functionnality, check SoundCloud's API Reference documentation.

like image 115
guillaume Avatar answered Jan 03 '23 00:01

guillaume