API 2.0 playlist

From DriveCast Wiki

Jump to: navigation, search

GET

   URL:        https://drivecast.eu/api/2.0/playlist/[<PLAYLIST_NAME>]
   Methods:    GET
   Returns:    200 OK + object containing the arrays of the playlists
               401 Unauthorized
   Formats:    json (default), xml, plist

Returns the list of the defined playlists and uids belongs to them

curl --user username:password "https://drivecast.eu/api/2.0/playlist/[<PLAYLIST_NAME>]?apikey=ABCDEFGHILMNOPQ"

{
   "statuscode":"200",
   "statusdesc":"OK",
   "elements":[
      {
         "name":"Kossuth",
         "uid":[
            "SDFGx",
            "ERTYG",
            "SDB"
         ]
      },
      {
         "name":"Slager",
         "uid":[
            "FHKDf",
            "DFGJ",
            "ASGSDGH"
         ]
      },
      {
         "name":"Scott Mills Daily",
         "uid":[

         ]
      }
   ]
}
curl --user username:password "https://drivecast.eu/api/2.0/playlist/[<PLAYLIST_NAME>]?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
<elements>
  <element>
    <name>Kossuth</name>
    <uid>SDFGx</uid>
    <uid>ERTYG</uid>
    <uid>SDB</uid>
  </element>
  <element>
    <name>Slager</name>
    <uid>FHKDf</uid>
    <uid>DFGJ</uid>
    <uid>ASGSDGH</uid>
  </element>
  <element>
    <name>Scott Mills Daily</name>
  </element>
</elements>
curl --user username:password "https://drivecast.eu/api/2.0/playlist/[<PLAYLIST_NAME>]?fmt=plist&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<dict>
  <key>statuscode</key>
  <string>200</string>
  <key>statusdesc</key>
  <string>OK</string>
  <key>elements</key>
  <array>
  <key>name</key>
  <string>Kossuth</string>
  <key>uid</key>
  <array>
  <key>0</key>
  <string>SDFGx</string>
  <key>1</key>
  <string>ERTYG</string>
  <key>2</key>
  <string>SDB</string>
  </array>
  <key>name</key>
  <string>Slager</string>
  <key>uid</key>
  <array>
  <key>0</key>
  <string>FHKDf</string>
  <key>1</key>
  <string>DFGJ</string>
  <key>2</key>
  <string>ASGSDGH</string>
  </array>
  <key>name</key><string>Scott Mills Daily</string>
  <key>uid</key>
  <array></array></array>
</dict>



POST

  URL:        https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>
  Methods:    POST
  Returns:    201 Created
              401 Unauthorized
              409 Playlist already present
  Formats:    No other data that the HTTP status code is returned

With POST a new empty playlist with the name is created

curl --user username:password -X POST "https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>?apikey=ABCDEFGHILMNOPQ"

{"statuscode":"200",
"statusdesc":"OK",
"id":"xCfg"
}
curl --user username:password -X POST "https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
<uid>xCfg</uid>
curl --user username:password -X POST "https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>?fmt=plist&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<plist>
 <dict>
   <key>statuscode</key>
   <string>200</string>
   <key>statusdesc</key>
   <string>OK</string>
   <key>uid</key>
   <string>xCfg</string>
 </dict>
</plist>

DELETE

  URL:        https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>
  Methods:    DELETE
  Returns:    200 OK
              401 Unauthorized
              404 Playlist does not exist
  Formats:    No other data that the HTTP status code is returned

With DELETE the playlist is removed

curl --user username:password -X DELETE "https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>?apikey=ABCDEFGHILMNOPQ"

{"statuscode":"200",
 "statusdesc":"OK"
}
curl --user username:password -X DELETE "https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
curl --user username:password -X DELETE "https://drivecast.eu/api/2.0/playlist/<PLAYLIST_NAME>?fmt=plist&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<plist>
 <dict>
   <key>statuscode</key>
   <string>200</string>
   <key>statusdesc</key>
   <string>OK</string>
 </dict>
</plist>
Personal tools