public
Description: SoundCloud API Code
Home | Edit | New

10.2 Resources: tracks cont.

GET /tracks/{track_id}

Result type: Track

Retrieves the given track.

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

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<track>
  <id type="integer">13</id>
  <permalink>superstitious</permalink>
  <title>Superstitious</title>
  ...
  <sharing>public</sharing>
</track>  

PUT /tracks/{track_id}

Updates the given track.

Parameters
Name Type Description
title string the title of the track
artwork_data file the artwork file
bpm float beats per minute
description string a description
downloadable boolean
genre string
isrc string
key_signature enumeration
label_id integer
label_name string
purchase_url string
release string
release_day integer
release_month integer
release_year integer
sharing enumeration (public, private)
streamable boolean
tag_list list a space separated list of tags
track_type enumeration
video_url string
license license
shared_to[emails][][address] array
$ curl 'http://api.soundcloud.com/tracks/13' -X PUT -H 'Content-Type: application/xml'  -d '
<track>
  <downloadable>true</downloadable>
  <shared_to>
    <emails type="array">
      <email>
        <address>a.user@example.com</address>
      </email>
    </emails>
  </shared_to>
</track>
'

The track will be downloadable and shared to the email address "a.user@example.com".

< HTTP/1.1 200 OK

DELETE /tracks/{track_id}

Deletes the given track

$ curl 'http://api.soundcloud.com/tracks/13' -X DELETE

< HTTP/1.1 200 OK

GET /tracks/{track_id}/comments

Type: Collection of Comments

Retrieves comments made on the given track.

$ curl 'http://api.soundcloud.com/tracks/9/comments'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<comments type="array">
  <comment>
    <body>A personal favorite of mine.</body>
    <id type="integer">2</id>
    <timestamp type="integer" nil="true"></timestamp>
    <track-id type="integer">9</track-id>
    <user-id type="integer">9</user-id>
    <uri>http://api.soundcloud.com/comments/2</uri>
    <created-at type="datetime">2008-08-06T21:46:38+02:00</created-at>
  </comment>
</comments>

POST /tracks/{track_id}/comments

Response Headers:
Location – The canonical URI of the comment

Creates a comment on the given track.

Parameters
Name Type Description
body string, required
timestamp integer milliseconds
reply_to integer if the comment is a reply to another comment, specify the other comment’s id
$ curl 'http://api.soundcloud.com/tracks/1/comments' -X POST -H 'Content-Type: application/xml'  -d '
<comment>
  <body>Yeah!</body>
</comment >
'

< HTTP/1.1 201 Created
< Location: http://api.soundcloud.com/comments/13

GET /tracks/{track_id}/permissions

Type: Collection of Users

Retrieves the users with permission to see the track.

$ curl 'http://api.soundcloud.com/tracks/10/permissions'

< HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
  <user>
    <city nil="true"></city>
    <description>Ich bin ein deutscher Komponist des Barock.</description>
    <discogs-name nil="true"></discogs-name>
    <id type="integer">8</id>
    <myspace-name nil="true"></myspace-name>
    <username>jsb</username>
    <website></website>
    <website-title nil="true"></website-title>
    <full-name>Johann Sebastian Bach</full-name>
    <country>Germany</country>
    <online>false</online>
    <avatar-url>http://a1.soundcloud.com/images/default_profile_image_big.png?2725</avatar-url>
    <uri>http://api.soundcloud.com/users/129</uri>
    <track-count>2</track-count>
    <permalink-url>http://soundcloud.com/jsb</permalink-url>
    <permalink>jsb</permalink>
  </user>
  <user>
    <city nil="true"></city>
    <description>Cool as ice.</description>
    <discogs-name nil="true"></discogs-name>
    <id type="integer">10</id>
    <myspace-name nil="true"></myspace-name>
    <username>vice</username>
    <website></website>
    <website-title nil="true"></website-title>
    <full-name>Robert Matthew Van Winkle</full-name>
    <country>United States</country>
    <online>true</online>
    <avatar-url>http://a1.soundcloud.com/images/default_profile_image_big.png?2725</avatar-url>
    <uri>http://api.soundcloud.com/users/3854</uri>
    <track-count>1</track-count>
    <permalink-url>http://soundcloud.com/vice</permalink-url>
    <permalink>vice</permalink>
  </user>
</users>

PUT /tracks/{track_id}/permissions

Updates the list of permitted users.

Parameters
Name Type Description
user_id[] array of integers the id’s of users to be granted permission
$ curl 'http://api.soundcloud.com/tracks/12/permissions' -X PUT -H 'Content-Type: application/xml' -d '
<permissions>
  <user-id>2</user-id>
  <user-id>3</user-id>
</permissions>
'

is equivalent to:

$ curl 'http://api.soundcloud.com/tracks/12/permissions' -X PUT -d 'permissions[user_id][]=2&permissions[user_id][]=3'

< HTTP/1.1 200 OK

GET /tracks/{track_id}/download

Type: Binary

Retrieves the original uploaded asset of the Track if it is downloadable.

$ curl 'http://api.soundcloud.com/tracks/1/download'

< HTTP/1.1 200 OK
< Content-Transfer-Encoding: binary
< Content-Disposition: attachment; filename="final_countdown.wav"
< Content-Type: audio/x-wav
Last edited by hannestyden, Mon Nov 16 22:00:40 -0800 2009
Home | Edit | New
Versions: