Skip to content

Add a screenshot or a text file to a result

POST
/v1/results/{id}/files
curl --request POST \
--url 'https://beta-api.plune.ai/v1/results/example/files?name=example' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: image/png' \
--data binary

The request body IS the file, and Content-Type says which kind (ADR 0040). A screenshot: PNG, JPEG or WebP, at most 2 MiB, up to 20 per result. A text (the amendment, #928): application/json or text/plain — a log is text/plain, whatever its name (.log, stdout, stderr) — as UTF-8 only, at most 512 KiB, up to 10 per result, counted apart from the screenshots. A text is cleaned of credentials before it is kept, by the pass a failure’s text goes through: colour codes go, and so do tokens, keys, cookies and Authorization values. What is kept is the cleaned text, its size is that, and it can be longer than what was sent — the 512 KiB ceiling is on both. The server does not parse JSON; cleaning can leave a JSON file that no longer parses, and a client reads it as text then. Trace and video are not accepted here. Into a run that is still open: a reporter uploads after each batch of results and before it closes the run, using the ids the batch answered with. Each project keeps its files, pictures and texts together, within a budget of 1 GiB: an upload that would pass it first deletes the project’s oldest files — the results stay, their files go. Only the files kept in the database count toward the budget and the allowances above; a file in the project’s bucket (POST /v1/results/{id}/files/uploads) counts toward neither, and is never one of the oldest that go. A project with a bucket sends everything there instead; this route stays for a project without one.

id
required
string

The result — items[].id of the batch that stored it.

name
required
string
<= 200 characters

What the file is called; only the last segment of a path is kept, and it is cleaned of credentials. At most 200 characters once cleaned.

string format: binary

Stored. evicted is there only when the budget sent files away for it (#1234)

Media type application/json

A file just stored, and — only when it sent anything away — what the budget evicted for it (#1234).

object
id
required
string
name
required

The last segment of the name it was uploaded with, cleaned of credentials as a text is.

string
contentType
required

In the database (storage: db): image/png, image/jpeg, image/webp, application/json or text/plain — a log is text/plain. In the bucket (storage: bucket): the media type it was announced with, lower case and without parameters, any type.

string
size
required

Bytes as kept: in the database a picture at most 2 MiB and a text at most 512 KiB, counted after its credentials are cleaned, so it can differ from what was sent; in the bucket the size that was announced and found there.

integer
storage
required

db: Plune keeps the bytes in its database, GET /v1/files/{id} returns them. bucket: they are in a bucket — the project’s own, or, for a built-in file of a server that keeps those in its own bucket (#1428), Plune’s — and GET /v1/files/{id} answers 409 in_bucket (the way to read them is GET /v1/files/{id}/link). A built-in file in Plune’s bucket counts toward the budget as one in the database does.

string
Allowed values: db bucket
evicted

What the 1 GiB budget of the project sent away to make room (#1234): the project’s oldest files kept in the database, a person’s as much as a reporter’s.

object
count
required
integer
>= 1
bytes
required
integer
>= 1
Example
{
"id": "3f0c2a7e-1b5d-4c8e-9a61-2d7f4e8b0c13",
"name": "signed-in.png",
"contentType": "image/png",
"size": 48213,
"storage": "db"
}

No name (or one over 200 characters once cleaned), an empty file, or a text with nothing left once cleaned

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

No / invalid token or session

A reader of the project

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

Not found or not yours

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

The run is closed (a result written by POST /v1/ingest/cairn takes files for 24 hours after its run, cli#138; its verdict never changes), or the result already has 20 screenshots (or 10 text files, for a text)

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

A screenshot larger than 2 MiB, or a text larger than 512 KiB — as sent, or once cleaned; or the file fits the storage budget only if files of bugs went — their copies and attachments are never sent away (code: over_budget)

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

A type that is not listed; a text in a charset other than UTF-8; or bytes that are not UTF-8 text (invalid UTF-8, or a NUL)

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

Rate-limited: the per-route throttle, or the per-minute request limit of the plan an API token counts by (#1442; the body names the plan, #2092). Retry-After carries the seconds until the window rolls over.

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}
Retry-After
integer

Seconds until the window rolls over

The server keeps built-in files in its own bucket and could not write this one there: nothing is stored, send it again (code: bucket_unreachable, #1428)

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}