API 2.0 playposition
From DriveCast Wiki
GET
URL: https://drivecast.eu/api/2.0/playposition/[<UID>]
Methods: GET
Returns: 200 OK + object containing the arrays of the played items positions
401 Unauthorized
Formats: json (default), xml, plist
Returns the list about the played items.
The item UID is optional, if it is missing all item(s) belong to the user will be displayed.
Info about one item are: UID, the server UTC time of stopped moment, the position (integer number which represents the seconds).
There is also info about server now time in UTC (could be useful for devices which time is not synchronized with an internet time server).
curl --user username:password "https://drivecast.eu/api/2.0/playposition/[<UID>]?apikey=ABCDEFGHILMNOPQ"
{
"statuscode":"200",
"statusdesc":"OK",
"UTCnow":"2010-05-24 12:23:44 UTC",
"elements":[
{
"uid" :"ABC",
"UTCstop" :"2010-05-24 10:23:44 UTC",
"position" :"10"
},
{
"uid" :"DEF",
"UTCstop" :"2010-05-24 09:23:44 UTC",
"position" :"10"
}
]
}
curl --user username:password "https://drivecast.eu/api/2.0/playposition/[<UID>]?fmt=xml&apikey=ABCDEFGHILMNOPQ"
<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
<UTCnow>2010-05-24 12:23:44 UTC</UTCnow>
<elements>
<element>
<uid>ABC</uid>
<UTCstop>2010-05-24 10:23:44 UTC</UTCstop>
<position>10</position>
</element>
<element>
<uid>DEF</uid>
<UTCstop>2010-05-24 09:23:44 UTC</UTCstop>
<position>10</position>
</element>
</elements>
curl --user username:password "https://drivecast.eu/api/2.0/playposition/[<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>UTCnow</key> <string>2010-05-24 12:23:44 UTC</string> <key>elements</key> <array> <key>uid</key> <string>ABC</string> <key>UTCstop</key> <string>2010-05-24 10:23:44 UTC</string> <key>position</key> <string>10</string> <key>uid</key> <string>DEF</string> <key>UTCstop</key> <string>2010-05-24 10:23:44 UTC</string> <key>position</key> <string>10</string> </array> </dict>
POST
With POST a UID is updated on the base of the object in the posted data
Fields used: playposition, UTCstop (YYYY-MM-DD HH:ii:ss UTC), UTCdevicenow (YYYY-MM-DD HH:ii:ss UTC).
In case of UTCdevicenow and UTCservernow is more different than 5 seconds the UTCstop, will be modified, adding or removing the difference, between UTCdevicenow and UTCservernow
URL: https://drivecast.eu/api/2.0/playposition/<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 POST -d '{"playposition":"20","UTCstop":"2010-05-21 23:11:12 UTC","UTCdevicenow":"2010-05-21 23:11:12 UTC"}' "https://drivecast.eu/api/2.0/playposition/<UID>?apikey=ABCDEFGHILMNOPQ"
{"statuscode":"200",
"statusdesc":"OK"}
curl --user username:password -X POST -d '{"playposition":"20","UTCstop":"2010-05-21 23:11:12 UTC","UTCdevicenow":"2010-05-21 23:11:12 UTC"}' "https://drivecast.eu/api/2.0/playposition/<UID>?fmt=xml&apikey=ABCDEFGHILMNOPQ"
<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
curl --user username:password -X POST -d '{"playposition":"20","UTCstop":"2010-05-21 23:11:12 UTC","UTCdevicenow":"2010-05-21 23:11:12 UTC"}' "https://drivecast.eu/api/2.0/playposition/<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>
