Add a screenshot or a text file to a result
const url = 'https://beta-api.plune.ai/v1/results/example/files?name=example';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'image/png'}, body: 'binary'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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 binaryThe 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.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The result — items[].id of the batch that stored it.
Query Parameters
Section titled “Query Parameters ”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.
Request Body required
Section titled “Request Body required ”Any JSON document, UTF-8.
object
Example
{ "orderId": "ord_1042", "status": "paid", "total": 4820}Text, UTF-8 — a log is one.
Example
GET /v1/runs?limit=50 200 12msPOST /v1/runs 201 48msResponses
Section titled “ Responses ”Stored
A file of a result, everything but its bytes (ADR 0040).
object
The last segment of the name it was uploaded with, cleaned of credentials as a text is.
A log is text/plain.
Bytes as kept: a picture at most 2 MiB; a text at most 512 KiB, and counted after its credentials are cleaned, so it can differ from what was sent.
Example
{ "id": "3f0c2a7e-1b5d-4c8e-9a61-2d7f4e8b0c13", "name": "signed-in.png", "contentType": "image/png", "size": 48213}No name (or one over 200 characters once cleaned), an empty file, or a text with nothing left once cleaned
object
Example generated
{ "error": "example"}No / invalid token or session
A reader of the project
object
Example generated
{ "error": "example"}Not found or not yours
object
Example generated
{ "error": "example"}The run is closed, or the result already has 20 screenshots (or 10 text files, for a text)
object
Example generated
{ "error": "example"}A screenshot larger than 2 MiB, or a text larger than 512 KiB — as sent, or once cleaned
object
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)
object
Example generated
{ "error": "example"}Rate-limited: either the per-route throttle or a tenant quota. Retry-After carries the seconds until the window rolls over.
object
Example generated
{ "error": "example"}Headers
Section titled “Headers ”Seconds until the window rolls over