LDWS API Storage Endpoints
Â
GET /v1/files/:path/Â
Lists directories and files in the requested path.
Segment
:path
string: The path to the directories or files
Query String Parameter
raw
optional: If the path is for a storage device, this will return its raw contents. For example, the request below would beGET /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: Name of the directory or filetype
string: Either a directory or filepath
 string: The path, for example, "sd"mime
string:Â mime type (available only for type "file")stat
object: Directory stats from the "fs" modulefileSize
int: The size of the filesystemstreamable
bool: This is alwaystrue
for files. If the path is a directory, this is not returned
Response Example
Â
POST /v1/files/:path/Â
Renames a file in the path (which should include the file name).
Segment
:path
string: The path to a file
Request Body
name
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:
Response
The player will return a 200 success or 404 or 500 error message.
Success Response Body
Â
PUT /v1/files/:path/Â
Uploads files or creates directories. The request body needs to be of type multipart
/form-data
(see RFC 7578). 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: The path is the folder in which you want to upload the file.
Request Body
files
object[]:fileName
string: The name of the filefileContents
string: The content of the file. It can be provided as plain text or as Data URL.fileType
string: Mime type
Request Example (File)
The example request parameters and headers are set as follows:
path
is set tosd
Response Body
success
bool: A flag that indicates if the operation succeeded or notresults
string[]: The names of the files that were successfully created
Response Example (Plain Text File)
Request Example (Folder)
Response Example (Folder)
Â
DELETE /v1/files/:path/Â
Removes a file or directory
Segment
:path
string: The path to the file or directory
Request Example
The example request parameters and headers are set as follows:
:path
is set tosd/test.txt
Response
The player will return a 200 success or 404 or 500 error message.
Success Response Body