SandboxesFiles

Upload through a signed URL

Replace the file of a PUT signed URL once, like PUT files/content.

  • An upload that starts uses the URL up, also when it fails. A refusal before it starts (403, 409, 429) keeps the URL.
  • Needs no other credential.
  • Served at the access endpoint. The mint returns the full URL.

See Share a file with a signed URL in the guide.

PUT
/v1/files/signed
AuthorizationBearer <token>

API key starting with tektona_. Create one at app-dev.tektona.ai under API Keys.

In: header

Query Parameters

token*string

The token from the signed URL

mode?integer

Permission bits as a decimal integer (493 is 0o755); setuid, setgid and sticky are refused

Range0 <= value <= 511

Header Parameters

If-Match?string
If-None-Match?"*"

Value in

  • "*"

Request Body

application/octet-stream

TypeScript Definitions

Use the request body type in TypeScript.

body*file
Formatbinary

Response Body

application/json

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X PUT "https://example.com/v1/files/signed?token=string" \  -H "Content-Type: application/octet-stream" \  -d 'string'
{  "entry": {    "gid": 0,    "group": "string",    "mode": 0,    "modified_at": "2019-08-24T14:15:22Z",    "name": "string",    "owner": "string",    "path": "string",    "size": 0,    "symlink_target": "string",    "type": "file",    "uid": 0  },  "etag": "string"}

Upload a tar archive PUT

Extract a tar or tar.gz archive into the directory at `path`. The API creates `path` and its parents. - A regular file goes through a temporary file and a rename. It gets the mode (0o777 bits) and mtime of the archive, and replaces an existing file. - A missing directory is created. An existing directory keeps its mode. - A symlink replaces its target path in one step. - The upload takes one transfer slot and stops after 60 seconds without progress. - Needs write access to the sandbox. - Runs in the sandbox as the image user, or as `user` when set. Setting `user` needs write access to the sandbox. - Served at the access endpoint of the sandbox (`access_endpoint` of `GET /v1/sandboxes/{sandboxId}`), not at the API host. - A paused sandbox returns 409, unless `resume=true`. A sandbox that started before its files server existed returns 409 `sandbox_update_required` until it restarts. - A refused operation returns its code as the problem type. - A path that starts with `~` or `~/` names the home directory of the user that the operation runs as. `~name` returns 422. See [Upload a folder](https://docs.tektona.ai/files#upload-a-folder) in the guide for `TEKTONA.keep_mode`, refused entries and partial failures.

Watch file changes GET

Upgrade to WebSocket and receive `SandboxFilesWatchFrame` JSON text frames. - Wait for `ready`. Then list or read what you need. Then apply the `changes` frames that arrived meanwhile, and the ones after. - `seq` counts the frames of this subscriber. A skipped `seq`, a frame that is not valid, or a close without `end` means lost changes: open a new watch and list again. - On `resync`, list again. `end` is the last frame. - Close code 4001 means the watch expired after 15 minutes. 1001 means the server shut down. - Needs read access. `user` needs write access. - Served at the access endpoint of the sandbox (`access_endpoint` of `GET /v1/sandboxes/{sandboxId}`). A browser offers the credential as the WebSocket protocol `Bearer-<token>`. See [Watch for changes](https://docs.tektona.ai/files#watch-for-changes) in the guide.