API 2.0 library

From DriveCast Wiki

Revision as of 15:35, 10 June 2010 by Cloddo (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

GET

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

Returns the list about the elements belongs to the user, the list of elements is ordered from the most recent to the oldest element

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

{
  "statuscode":"200",
  "statusdesc":"OK",
  "elements":[
     {
        "uid":"ABC",
        "author":"CNN",
        "thumbnail":"http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg",
        "title":"CNN News Update (8-13-2009 1 AM EDT)",
        "description":"The latest news happenings in the U.S.",
        "playlist_string":"CNN News Update",
        "enclosure_url":"http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/fTrx3Pzv1iQ/CNN-News-08-13-09-1AM.mp3",
        "length":"2039583",
        "type":"audio"
     },
     {
        "uid":"CDE",
        "author":"CNN",
        "thumbnail":"http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg",
        "title":"CNN News Update (8-13-2009 2 AM EDT)",
        "description":"The latest news happenings in the U.S.",
        "playlist_string":"CNN News Update",
        "enclosure_url":"http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/RNQLSP4hYdo/CNN-News-08-13-09-2AM.mp3",
        "length":"2038747",
        "type":"audio"
     },
     {
        "uid":"FGH",
        "author":"CNN",
        "thumbnail":"http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg",
        "title":"CNN News Update (8-13-2009 3 AM EDT)",
        "description":"The latest news happenings in the U.S.",
        "playlist_string":"CNN News Update",
        "enclosure_url":"http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/S8d0M1SxJcY/CNN-News-08-13-09-3AM.mp3",
        "length":"2038956",
        "type":"audio"
     }
  ]
}
curl --user username:password "https://drivecast.eu/api/2.0/library/[<UID>]?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
<elements>
  <element>
    <uid>ABC</uid>
    <author>CNN</author>
    <thumbnail>http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg</thumbnail>
    <title>CNN News Update (8-13-2009 1 AM EDT)</title>
    <description>The latest news happenings in the U.S.</description>
    <playlist_string>CNN News Update</playlist_string>
    <enclosure_url>http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/fTrx3Pzv1iQ/CNN-News-08-13-09-1AM.mp3</enclosure_url>
    <length>2039583</length>
    <type>audio</type>
  </element>
  <element>
    <uid>CDE</uid>
    <author>CNN</author>
    <thumbnail>http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg</thumbnail>
    <title>CNN News Update (8-13-2009 2 AM EDT)</title>
    <description>The latest news happenings in the U.S.</description>
    <playlist_string>CNN News Update</playlist_string>
    <enclosure_url>http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/RNQLSP4hYdo/CNN-News-08-13-09-2AM.mp3</enclosure_url>
    <length>2038747</length>
    <type>audio</type>
  </element>
  <element>
    <uid>FGH</uid>
    <author>CNN</author>
    <thumbnail>http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg</thumbnail>
    <title>CNN News Update (8-13-2009 3 AM EDT)</title>
    <description>The latest news happenings in the U.S.</description>
    <playlist_string>CNN News Update</playlist_string>
    <enclosure_url>http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/S8d0M1SxJcY/CNN-News-08-13-09-3AM.mp3</enclosure_url>
    <length>2038956</length>
    <type>audio</type>
  </element>
</elements>

curl --user username:password "https://drivecast.eu/api/2.0/library/[<UID>]?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>uid</key>
  <string>ABC</string>
  <key>author</key>
  <string>CNN</string>
  <key>thumbnail</key>
  <string>http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg</string>
  <key>title</key>
  <string>CNN News Update (8-13-2009 1 AM EDT)</string>
  <key>description</key>
  <string>The latest news happenings in the U.S.</string>
  <key>playlist_string</key>
  <string>CNN News Update</string>
  <key>enclosure_url</key>
  <string>http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/fTrx3Pzv1iQ/CNN-News-08-13-09-1AM.mp3</string>
  <key>length</key>
  <string>2039583</string>
  <key>type</key>
  <string>audio</string>
  <key>uid</key>
  <string>CDE</string>
  <key>author</key>
  <string>CNN</string>
  <key>thumbnail</key>
  <string>http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg</string>
  <key>title</key>
  <string>CNN News Update (8-13-2009 2 AM EDT)</string>
  <key>description</key>
  <string>The latest news happenings in the U.S.</string>
  <key>playlist_string</key>
  <string>CNN News Update</string>
  <key>enclosure_url</key>
  <string>http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/RNQLSP4hYdo/CNN-News-08-13-09-2AM.mp3</string>
  <key>length</key>
  <string>2038747</string>
  <key>type</key>
  <string>audio</string>
  <key>uid</key>
  <string>FGH</string>
  <key>author</key>
  <string>CNN</string>
  <key>thumbnail</key>
  <string>http://i.cdn.turner.com/cnn/services/podcasting/images/news_update.jpg</string>
  <key>title</key>
  <string>CNN News Update (8-13-2009 3 AM EDT)</string><key>description</key>
  <string>The latest news happenings in the U.S.</string>
  <key>playlist_string</key>
  <string>CNN News Update</string>
  <key>enclosure_url</key><string>http://rss.cnn.com/~r/services/podcasting/newscast/rss/~5/S8d0M1SxJcY/CNN-News-08-13-09-3AM.mp3</string>
  <key>length</key>
  <string>2038956</string>
  <key>type</key>
  <string>audio</string>
  </array>
</dict>



DELETE

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

With DELETE the UID is removed

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

{"statuscode":"200",
 "statusdesc":"OK"
}
curl --user username:password -X DELETE "https://drivecast.eu/api/2.0/library/<UID>?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/library/<UID>?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>



PUT

With PUT a UID is updated on the base of the object in the posted data

   URL:        https://drivecast.eu/api/2.0/library/<UID>
   Methods:    PUT
   Returns:    200 OK + object containing the UID 
               401 Unauthorized
               404 UID does not exist
   Formats:    json (default), xml, plist
curl --user username:password -X PUT -d '{"author":"Mofified Author","title":"Modified Title","description":"Modified Description"}' "https://drivecast.eu/api/2.0/library/<UID>?apikey=ABCDEFGHILMNOPQ"

{"statuscode":"200",
"statusdesc":"OK"}
curl --user username:password -X PUT -d '{"author":"Mofified Author","title":"Modified Title","description":"Modified Description"}' "https://drivecast.eu/api/2.0/library/<UID>?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
curl --user username:password -X PUT -d '{"author":"Mofified Author","title":"Modified Title","description":"Modified Description"}' "https://drivecast.eu/api/2.0/library/<UID>?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