public
Description: SoundCloud API Code
Home | Edit | New

10.1 Resources: users

Resource Method
/users/ GET
/users/{user_id} GET, PUT
/users/{user_id}/tracks GET
/users/{user_id}/comments GET
/users/{user_id}/followings GET
/users/{user_id}/followings/{contact_id} GET, PUT, DELETE
/users/{user_id}/followers GET
/users/{user_id}/comments GET
/users/{user_id}/favorites GET
/users/{user_id}/favorites/{track_id} GET, PUT, DELETE
/users/{user_id}/groups/ GET

For each resource /users/{user_id}* there is a resource /me*.
Using these resources gives the logged in user as the given user.

/me specific resources

Resource Method
me/followings/tracks GET
GET me/followings/tracks

Type: Collection of Tracks

Tracks by the users the currently logged in user is following

Deprecated resources

Resource Method
/users/{user_id}/contacts GET
/users/{user_id}/contacts/{contact_id} GET, PUT, DELETE
/users/{user_id}/fans GET
/users/{user_id}/contacts

Please use the /users/{user_id}/followings resource instead.

/users/{user_id}/fans

Please use the /users/{user_id}/followers resource instead.

GET /users

Type: Collection of Users

Retrieves all users.

Parameters
Name Type Description
q string a string to search for (use double quotes to do literal string search)
$ curl 'http://api.soundcloud.com/users'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
  <user>
    <id type="integer">1</id>
    <username>joey</username>
    ...
  </user>
</users>

The resource is searchable by passing the query to the resource. It then lists a subset matching the search query.

$ curl 'http://api.soundcloud.com/users?q=seba'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
  <user>
    <id type="integer">2</id>
    <username>jsb</username>
    <full-name>Johann Sebastian Bach</full-name>
    ...
  </user>
  <user>
    <id type="integer">5</id>
    <username>seba</username>
    <full-name>Sebastian Ahrenberg</full-name>
    ...
  </user>
</users>

GET /users/{user_id}

GET /me

Type: User

The given user.

$ curl 'http://api.soundcloud.com/me'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<user>
  <id type="integer">1</id>
  <username>joey</username>
  ...
</user>

GET /users/{user_id}/tracks

GET /me/tracks

Type: Collection of Tracks

The given user’s uploaded tracks.

$ curl 'http://api.soundcloud.com/me/tracks'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<tracks type="array">
  <track>
    <id type="integer">12</id>
    <title>Carrie</title>
    ...
    <sharing>private</sharing>
  </track>
  <track>
    <id type="integer">11</id>
    <title>Final Countdown</title>
    ...
    <sharing>public</sharing>
  </track>
</tracks>

Requesting the tracks resource of another user:

$ curl 'http://api.soundcloud.com/users/2/tracks'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<tracks type="array">
  <track>
    <id type="integer">21</id>
    <title>The Musical Offering</title>
    ...
    <sharing>public</sharing>
  </track>
</tracks>

The resource is searchable by passing the query to the resource. It then lists a subset matching the search query.

GET /users/{user_id}/comments

GET /me/comments

Type: Collection of Comments

Comments made by the given user.

GET /users/{user_id}/followings

GET /me/followings

Type: Collection of Users

The given user’s contacts.

$ curl 'http://api.soundcloud.com/users/2/followings'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
  <user>
    <id type="integer">3</id>
    <username>vice</username>
    ...
  </user>
  <user>
    <id type="integer">4</id>
    <username>mchammer</username>
    ...
  </user>
</users>

PUT /users/{user_id}/followings/{contact_id}

PUT /me/followings/{contact_id}

Adds the user with the id contact_id to the given user’s list of contacts. Responds with 403 Forbidden if the given user is not the logged in user.

$ curl 'http://api.soundcloud.com/users/1/followings/21' -X PUT

< HTTP/1.1 201 Created

DELETE /users/{user_id}/followings/{contact_id}

DELETE /me/followings/{contact_id}

Removes the user with the id contact_id from the given user’s list of contacts. Responds with 403 Forbidden if the given user is not the logged in user.

$ curl 'http://api.soundcloud.com/users/1/followings/21' -X DELETE

< HTTP/1.1 200 OK

GET /users/{user_id}/followers

GET /me/followers

Type: Collection of Users

The given user’s fans.

$ curl 'http://api.soundcloud.com/users/2/followers/'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
  <user>
    <id type="integer">3</id>
    <username>vice</username>
    ...
  </user>
  <user>
    <id type="integer">4</id>
    <username>mchammer</username>
    ...
  </user>
</users>

GET /users/{user_id}/favorites

GET /me/favorites

Type: Collection of Tracks

The given user’s favorited tracks.

$ curl 'http://api.soundcloud.com/users/1/favorites/'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<tracks type="array">
  <track>
    <id type="integer">21</id>
    <title>The Musical Offering</title>
    ...
    <sharing>public</sharing>
  </track>
</tracks>

PUT /users/{user_id}/favorites/{track_id}

PUT /me/favorites/{track_id}

Adds the given track to the given user’s list of favorites. Responds with 403 Forbidden if the given user is not the logged in user.

$ curl 'http://api.soundcloud.com/me/favorites/3' -X PUT

< HTTP/1.1 201 Created

DELETE /users/{user_id}/favorites/{track_id}

DELETE /me/favorites/{track_id}

Adds the given track to the given user’s list of favorites. Responds with 403 Forbidden if the given user is not the logged in user.

$ curl 'http://api.soundcloud.com/users/1/favorites/3' -X DELETE

< HTTP/1.1 200 OK

GET /users/{user_id}/groups

GET /me/groups

Type: Collection of Groups

The Groups the given user has joined

$ curl 'http://api.soundcloud.com/users/1/groups/'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<groups type="array">
  <group>
    <id type="integer">1</id>
    <uri>http://api.soundcloud.com/groups/1</uri>
    <name>Ice Cream Lovers Unite</name>
    <permalink-url>http://soundcloud.com/groups/ice-cream-lovers-unite</permalink-url>
    <creator>
      <username>vice</username>
      ...
    </creator>
    ...
  </group>
</groups>
Last edited by hannestyden, Tue Oct 06 02:25:05 -0700 2009
Home | Edit | New
Versions: