Zudoku
Unikraft Cloud Sandbox Plugin API

Filesystem

Server

Create Directory

POST
http://localhost:7263
/fs/mkdir

Create a directory in the sandbox filesystem. 500 is returned when the directory could not be created.

Create Directory › Request Body

The request to create a directory in the sandbox filesystem.
path
​string · required

The absolute path of the directory to create.

Example: /tmp/demo
parents
​boolean · required

Whether to create missing parent directories.

Create Directory › Responses

The outcome of creating the directory.

A response which carries no data of its own. `data` is `null`; the outcome of the request is the HTTP status code.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
data
​required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Read File

POST
http://localhost:7263
/fs/read

Read the contents of a file, base64-encoded. 500 is returned when the file could not be read.

Read File › Request Body

The request to read a file from the sandbox filesystem.
path
​string · required

The absolute path of the file to read.

Example: /tmp/demo/file.txt

Read File › Responses

The base64-encoded contents of the file.

The response to reading a file. `500` is returned when the file could not be read.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
​object · required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Read Raw File

POST
http://localhost:7263
/fs/read_raw

Download the contents of a file verbatim.

Read Raw File › Request Body

The request to read a file from the sandbox filesystem.
path
​string · required

The absolute path of the file to read.

Example: /tmp/demo/file.txt

Read Raw File › Responses

The contents of a file, returned verbatim and unenveloped. 404 is returned when the file does not exist.

binary · application/octet-stream

Upload File

POST
http://localhost:7263
/fs/upload

Upload a file to the sandbox at a given path. A new file will be created at

  • if path ends with '/' or exists and is a directory: path/filename
  • else: path 400 is returned when encoding is not a known encoding or data is not valid base64, and 500 when the file could not be created.

Upload File › Request Body

The request to upload a file to the sandbox filesystem.
path
​string · required

Path where to upload the file.

Example: /tmp/demo
filename
​string · required

Name of uploaded file; will be used if path is a directory.

Example: file.txt
parents
​boolean · required

Whether to create parent directories of path.

encoding
​string · enum · required

The encoding of data.

Enum values:
utf-8
base64
data
​string · required

The data to write, in the given encoding

Example: hello

Upload File › Responses

The outcome of uploading the file.

A response which carries no data of its own. `data` is `null`; the outcome of the request is the HTTP status code.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
data
​required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Write File

POST
http://localhost:7263
/fs/write

Write data to a file, creating it if it does not exist. 400 is returned when encoding is not a known encoding or data is not valid base64, and 500 when the file could not be written.

Write File › Request Body

The request to write a file in the sandbox filesystem.
path
​string · required

The absolute path of the file to write. It is created if missing.

Example: /tmp/demo/file.txt
append
​boolean · required

Whether to append to the file instead of truncating it.

encoding
​string · enum · required

The encoding of data.

Enum values:
utf-8
base64
data
​string · required

The data to write, in the given encoding.

Example: hello

Write File › Responses

The outcome of writing the file.

A response which carries no data of its own. `data` is `null`; the outcome of the request is the HTTP status code.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
data
​required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.