Device
From DriveCast Wiki
GET
URL: https://drivecast.eu/api/1.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/1.0/device?apikey=ABCDEFGHILMNOPQ"
{"statuscode":"200",
"statusdesc":"OK",
"device":["Device I","Device II","Device III" }
curl --user username:password "https://drivecast.eu/api/1.0/device?fmt=xml&apikey=ABCDEFGHILMNOPQ" <?xml version="1.0" encoding="UTF-8"?> <statuscode>200</statuscode> <statusdesc>OK</statusdesc> <device>Device I</device> <device>Device II</device> <device>Device III</device>
curl --user username:password "https://drivecast.eu/api/1.0/device?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>device</key>
<array>
<string>Device I</string>
<string>Device II</string>
<string>Device III</string>
</array>
</dict>
</plist>
GET detail
URL: https://drivecast.eu/api/1.0/device/<DEVICE_NAME>
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/1.0/device/<DEVICE_NAME>?apikey=ABCDEFGHILMNOPQ"
{"statuscode":"200",
"statusdesc":"OK",
}
curl --user username:password "https://drivecast.eu/api/1.0/device/<DEVICE_NAME>?fmt=xml&apikey=ABCDEFGHILMNOPQ" <?xml version="1.0" encoding="UTF-8"?> <statuscode>200</statuscode> <statusdesc>OK</statusdesc>
curl --user username:password "https://drivecast.eu/api/1.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>
POST
URL: https://drivecast.eu/api/1.0/device/<DEVICE_NAME>
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
curl --user username:password -X POST "https://drivecast.eu/api/1.0/device/<DEVICE_NAME>?apikey=ABCDEFGHILMNOPQ"
{"statuscode":"200",
"statusdesc":"OK"
}
curl --user username:password -X POST "https://drivecast.eu/api/1.0/device/<DEVICE_NAME>?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/1.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>
DELETE
URL: https://drivecast.eu/api/1.0/device/<DEVICE_NAME>
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/1.0/device/<DEVICE_NAME>?apikey=ABCDEFGHILMNOPQ"
{"statuscode":"200",
"statusdesc":"OK"
}
curl --user username:password -X DELETE "https://drivecast.eu/api/1.0/device/<DEVICE_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/1.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>
