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:
"name": "newname.txt"
Response
The player will return a 200 success or 404 or 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). 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
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: 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)
{ "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: 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
DELETE /api/v1/files/sd/test.txt/ HTTP/1.1 Host: {{playerIP}} Authorization: {{DigestAuth}} Accept: application/json
Response
The player will return a 200 success or 404 or 500 error message.
Success Response Body
{ "data": { "result": { "success": true } } }