Diagnostic Web Server APIs
Local DWS APIs
LDWS Storage Endpoints
15min
get /v1/files/\ path/ lists directories and files in the requested path segment \ path string string the path to the directories or files query string parameter raw optional optional if the path is for a storage device, this will return its raw contents for example, the request below would be get /api/v1/files/sd/?raw request example the example request parameters and headers are set as follows \ path is set to /sd/autorun brs/ get /api/v1/files/sd/autorun brs/ http/1 1 host {{playerip}} authorization {{digestauth}} accept application/json response body this method returns the metadata for a directory or file (assuming the raw query string parameter is not set) name string string name of the directory or file type string string either a directory or file path string string the path, for example, "sd" mime string string mime type (available only for type "file") stat object object directory stats from the "fs" module filesize int int the size of the filesystem streamable bool bool this is always true for files if the path is a directory, this is not returned response example { "data" { "result" { "name" "sd/autorun brs", "type" "file", "path" "sd/autorun brs", "mime" "application/octet stream", "stat" { "dev" 45921, "mode" 33277, "nlink" 1, "uid" 0, "gid" 1003, "rdev" 0, "blksize" 32768, "ino" 40, "size" 1144340, "blocks" 2240, "atimems" 1699401600000, "mtimems" 1699423824000, "ctimems" 1699423824440, "birthtimems" 0, "atime" "2023 11 08t00 00 00 000z", "mtime" "2023 11 08t06 10 24 000z", "ctime" "2023 11 08t06 10 24 440z", "birthtime" "1970 01 01t00 00 00 000z" }, "filesize" 1144340, "streamable" true } } } post /v1/files/\ path/ renames a file in the path (which should include the file name) segment \ path string string the path to a file request body name string string the new file name request example the example request parameters and headers are set as follows \ path is set to /sd/test txt/ post /api/v1/files/sd/test txt/ http/1 1 host {{playerip}} authorization {{digestauth}} accept application/json content type application/json content length 21 this is the example request body "name" "newname txt" response the player will return a 200 200 success or 404 404 or 500 500 error message success response body { "data" { "result" { "success" true } } } put /v1/files/\ path/ uploads files or creates directories the request body needs to be of type multipart / form data (see rfc 7578 https //datatracker ietf org/doc/html/rfc7578 ) if you add one or more parameters of type file (the name of the parameter does not matter), it will upload the selected file(s) to create a directory, remove the form data from the body, and add the directory as the url parameter, \ path see the example below segment \ path string string the path is the folder in which you want to upload the file request body files object\[] object\[] filename string string the name of the file filecontents string string the content of the file it can be provided as plain text or as data url filetype string string mime type request example (file) the example request parameters and headers are set as follows path is set to sd put /api/v1/files/sd/ http/1 1 host {{playerip}} authorization {{digestauth}} content length 227 content type multipart/form data; boundary= webkitformboundary7ma4ywxktrzu0gw \ webkitformboundary7ma4ywxktrzu0gw content disposition form data; name="file"; filename="/path/to/file/test txt" content type text/plain (data) \ webkitformboundary7ma4ywxktrzu0gw response body success bool bool a flag that indicates if the operation succeeded or not results string\[] string\[] the names of the files that were successfully created response example (plain text file) { "data" { "result" { "success" true, "results" \[ "test txt" ] } } } request example (folder) put /api/v1/files/sd/testfolder/ host {{playerip}} authorization {{digestauth}} accept application/json, application/vnd bsn error+json response example (folder) { "data" { "result" { "success" true } } } delete /v1/files/\ path/ removes a file or directory segment \ path string string the path to the file or directory request example the example request parameters and headers are set as follows \ path is set to sd/test txt delete /api/v1/files/sd/test txt/ http/1 1 host {{playerip}} authorization {{digestauth}} accept application/json response the player will return a 200 200 success or 404 404 or 500 500 error message success response body { "data" { "result" { "success" true } } }