API 2.0 device
From DriveCast Wiki
GET
URL: https://drivecast.eu/api/2.0/device
Methods: GET
Returns: 200 OK + object containing the arrays of the devices
401 Unauthorized
Formats: json (default), xml, plist
Returns the list of the defined devices:
curl --user username:password "https://drivecast.eu/api/2.0/device?apikey=ABCDEFGHILMNOPQ"
{
"statuscode":"200",
"statusdesc":"OK",
"elements":[
{
"device_name":"Device I",
"type":"itunes",
"sync_type":"manual",
"serial":"SER_NO",
"playlists":[
"CNN News Update"
]
},
{
"device_name":"Device II",
"type":"reader",
"serial":"SER_NO",
"sync_type":"complete"
}
]
}
curl --user username:password "https://drivecast.eu/api/2.0/device?fmt=xml&apikey=ABCDEFGHILMNOPQ" <?xml version="1.0" encoding="UTF-8"?> <statuscode>200</statuscode> <statusdesc>OK</statusdesc> <elements> <element> <device_name>Device I</device_name> <type>itunes</type> <sync_type>manual</sync_type> <serial>SER_NO</serial> <playlists>CNN News Update</playlists> </element> <element> <device_name>Device II</device_name> <type>reader</type> <sync_type>complete</sync_type> <serial>SER_NO</serial> </element> </elements>
curl --user username:password "https://drivecast.eu/api/2.0/device?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>device_name</key> <string>Device I</string> <key>type</key><string>itunes</string> <key>sync_type</key> <string>manual</string> <key>serial</key> <string>SER_NO</string> <key>playlists</key> <array><key>0</key> <string>CNN News Update</string> </array> <key>device_name</key> <string>Device II</string> <key>type</key> <string>reader</string> <key>sync_type</key> <string>complete</string> <key>serial</key> <string>SER_NO</string> </array> </dict>
GET detail
URL: https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]
Methods: GET
Returns: 200 OK
401 Unauthorized
404 Device does not exist
Formats: json (default), xml, plist
curl --user username:password "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]?apikey=ABCDEFGHILMNOPQ"
{
"statuscode":"200",
"statusdesc":"OK",
"elements":[
{
"device_name":"Device II",
"type":"reader",
"sync_type":"manual",
"serial":"SER_NO",
"playlists":[
"Kossuth",
"Slager",
"Vcast2"
]
}
]
}
curl --user username:password "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]?fmt=xml&apikey=ABCDEFGHILMNOPQ"
<?xml version="1.0" encoding="UTF-8"?>
<statuscode>200</statuscode>
<statusdesc>OK</statusdesc>
<elements>
<element>
<device_name>Device II</device_name>
<type>reader</type>
<sync_type>manual</sync_type>
<serial>SER_NO</serial>
<playlists>Kossuth</playlists>
<playlists>Slager</playlists>
<playlists>Vcast2</playlists>
</element>
</elements>
curl --user username:password "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]?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>device_name</key> <string>Device II</string> <key>type</key> <string>reader</string> <key>sync_type</key> <string>manual</string> <key>serial</key> <string>SER_NO</string> <key>playlists</key> <array><key>0</key> <string>Kossuth</string> <key>1</key> <string>Slager</string> <key>2</key> <string>Vcast2</string> </array> </array> </dict>
POST
URL: https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]/[<DEVICE_TYPE>]
Methods: POST
Returns: 201 Created
401 Unauthorized
409 Device already present
Formats: No other data that the HTTP status code is returned
With POST a new empty device with the name is created with type complete
curl --user username:password -X POST "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]/[<DEVICE_TYPE>]?apikey=ABCDEFGHILMNOPQ"
{"statuscode":"200",
"statusdesc":"OK"
}
curl --user username:password -X POST "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]/[<DEVICE_TYPE>]?fmt=xml&apikey=ABCDEFGHILMNOPQ" <?xml version="1.0" encoding="UTF-8"?> <statuscode>200</statuscode> <statusdesc>OK</statusdesc>
curl --user username:password -X POST "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]/[<DEVICE_TYPE>]?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>
DELETE
URL: https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]
Methods: DELETE
Returns: 200 OK
401 Unauthorized
404 Device does not exist
Formats: No other data that the HTTP status code is returned
With DELETE the device is removed
curl --user username:password -X DELETE "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]?apikey=ABCDEFGHILMNOPQ"
{"statuscode":"200",
"statusdesc":"OK"
}
curl --user username:password -X DELETE "https://drivecast.eu/api/2.0/device/<DEVICE_NAME>/[<DEVICE_SERIAL>]?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/device/<DEVICE_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>
