API 2.0 podcast

From DriveCast Wiki

Revision as of 16:29, 3 November 2009 by Szbela (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

GET

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

Returns the list of the podcast

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

{
  "statuscode":"200",
  "statusdesc":"OK",
  "elements":[
     {
        "uid":"x=ME=jAN",
        "title":"CNN News Update",
        "description":"The latest news happening in the U.S. and around the world.",
        "subscription_type":"Only the last 3 episodes"
        "feed":"http://rss.cnn.com/services/podcasting/newscast/rss.xml"
     },
     {
        "uid":"x=ME=jQN",
        "title":"Friday Night Comedy from BBC Radio 4",
        "description":"Bringing you both The Now Show and The News Quiz from BBC Radio 4",
        "subscription_type":"Only the last 3 episodes"
        "feed":"http://www.npr.org/rss/podcast.php?id=35"
     }
  ]
}
curl --user username:password "https://drivecast.eu/api/2.0/podcast/[<UID>]?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
<elements>
  <element>
    <uid>x=ME=jAN</uid>
    <title>CNN News Update</title>
    <description>The latest news happening in the U.S. and around the world.</description>
    <subscription_type>Only the last 3 episodes</subscription_type>
    <feed>http://rss.cnn.com/services/podcasting/newscast/rss.xml</feed>
  </element>
  <element>
    <uid>x=ME=jQN</uid>
    <title>Friday Night Comedy from BBC Radio 4</title>
    <description>Bringing you both The Now Show and The News Quiz from BBC Radio 4. Enjoy a satirical take on the week></description>
    <subscription_type>Only the last 3 episodes</subscription_type>
    <feed>http://www.npr.org/rss/podcast.php?id=35</feed>
  </element>
</elements>


curl --user username:password "https://drivecast.eu/api/2.0/podcast/[<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>x=ME=jAN</string>
  <key>title</key>
  <string>CNN News Update</string>
  <key>description</key>
  <string>The latest news happening in the U.S. and around the world.</string>
  <key>subscription_type</key>
  <string>Only the last 3 episodes</string>
  <key>feed</key><string>http://rss.cnn.com/services/podcasting/newscast/rss.xml</string>
  <key>uid</key>
  <string>x=ME=jQN</string>
  <key>title</key>
  <string>Friday Night Comedy from BBC Radio 4</string>
  <key>description</key>
  <string>Bringing you both The Now Show and The News Quiz from BBC Radio 4.></string>
  <key>subscription_type</key><string>Only the last 3 episodes</string>
  <key>feed</key><string>http://www.npr.org/rss/podcast.php?id=35</string>
  </array>
</dict>



DELETE

   URL:        https://drivecast.eu/api/2.0/podcast/<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/podcast/<UID>?apikey=ABCDEFGHILMNOPQ"

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



POST

With POST a new record is inserted on base of the object in the posted data

   URL:        https://drivecast.eu/api/2.0/podcast
   Methods:    POST
   Returns:    200 OK
               401 Unauthorized
               501 Error Message
   Formats:    No other data that the HTTP status code is returned


curl --user username:password -X POST -d '{"podcast_url":"http://rss.cnn.com/services/podcasting/newscast/rss.xml","podcast_title":"Cnn Title Modified","podcast_description":"Podcast Description MODIFIED"}' "https://drivecast.eu/api/2.0/podcast?apikey=ABCDEFGHILMNOPQ"

{"statuscode":"200",
"statusdesc":"Insert OK",
"uid":"xFg",
}


curl --user username:password -X POST -d '{"podcast_url":"http://rss.cnn.com/services/podcasting/newscast/rss.xml","podcast_title":"Cnn Title Modified","podcast_description":"Podcast Description MODIFIED"}' "https://drivecast.eu/api/2.0/podcast?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>Insert OK</statusdesc>
<uid>xFg</uid>
curl --user username:password -X POST -d '{"podcast_url":"http://rss.cnn.com/services/podcasting/newscast/rss.xml","podcast_title":"Cnn Title Modified","podcast_description":"Podcast Description MODIFIED"}' "https://drivecast.eu/api/2.0/podcast?fmt=plist&apikey=ABCDEFGHILMNOPQ"

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



PUT

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

   URL:        http://drivecast.eu/api/2.0/podcast/<UID>
   Methods:    PUT
   Returns:    200 OK
               401 Unauthorized
               404 podcast does not exis
               501 Error Message
   Formats:    No other data that the HTTP status code is returned


curl --user username:password -X PUT -d '{"podcast_url":"http://rss.cnn.com/services/podcasting/newscast/rss.xml","podcast_title":"Cnn Title Modified","podcast_description":"Podcast Description MODIFIED"}' "https://drivecast.eu/api/2.0/podcast/<UID>?apikey=ABCDEFGHILMNOPQ"

{"statuscode":"200",
"statusdesc":"Update OK"}


curl --user username:password -X PUT -d '{"podcast_url":"http://rss.cnn.com/services/podcasting/newscast/rss.xml","podcast_title":"Cnn Title Modified","podcast_description":"Podcast Description MODIFIED"}' "https://drivecast.eu/api/2.0/podcast/<UID>?fmt=xml&apikey=ABCDEFGHILMNOPQ"

<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>Update OK</statusdesc>
curl --user username:password -X PUT -d '{"podcast_url":"http://rss.cnn.com/services/podcasting/newscast/rss.xml","podcast_title":"Cnn Title Modified","podcast_description":"Podcast Description MODIFIED"}' "https://drivecast.eu/api/2.0/podcast/<UID>?fmt=plist&apikey=ABCDEFGHILMNOPQ"

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