public
Description: SoundCloud API Code
Home | Edit | New

05 Request Content Types

When creating or updating resources data can be passed as urlencoded, in XML or JSON.

The three examples below are equivalent:

URL encoded:

$ curl 'http://api.soundcloud.com/tracks' -X POST -d 'track[title]=Superstitious&track[description]=A song about people.'

XML:

$ curl 'http://api.soundcloud.com/tracks' -X POST -H 'Content-Type: application/xml'  -d '
<track>
  <title>Superstitious</title>
  <description>A song about people.</description></track>
'

JSON:

$ curl 'http://api.soundcloud.com/tracks' -X POST -H 'Content-Type: application/json'  -d '
{
  "track": {
      "title":       "Superstitious",
      "description": "A song about people."
  }
}
'

The examples below will use XML-format.

Last edited by lenberg, Tue Sep 08 06:38:06 -0700 2009
Home | Edit | New
Versions: