Send a file to a review item
const url = 'https://beta-api.plune.ai/v1/review-items/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/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/review-items/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/files?name=example' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: image/png' \ --data binaryA picture or a text of a Cairn run onto the proposal it queued (cli#138), for a project without a bucket - the body IS the file, as POST /v1/results/{id}/files, with the same types and ceilings (2 MiB a picture, 512 KiB a text, cleaned of credentials). A writer of the project’s queue (a reader is refused); an item of another project, in the Bin, or never issued is a 404; a decided item (approved or rejected) takes no more files (409). The files are read on GET /v1/review-items/{id} (files). Approving a proposal whose run measured a verdict moves them onto the result that approval writes; otherwise they stay on the item. Not audited: machine intake, as a result’s files.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Header Parameters
Section titled “Header Parameters ”Which of your projects to act in — an id from GET /v1/projects. Absent, your default project. A project you are not a member of answers 404, the same as one that does not exist. Ignored under a bearer token, which is bound to the project it was minted in.
Query Parameters
Section titled “Query Parameters ”What the file is called; only the last segment of a path is kept, cleaned of credentials.
Request Body required
Section titled “Request Body required ”Any JSON document, UTF-8.
object
Example
{ "currency": "EUR", "rate": 1.08}Text, UTF-8 — a log is one.
Example
POST /v1/cart/coupon 422 31msResponses
Section titled “ Responses ”Stored
A file of a result, everything but its bytes (ADR 0040, ADR 0041). Only a finished file is ever shown: one that was announced with uploads and not yet completed is in no list.
object
The last segment of the name it was uploaded with, cleaned of credentials as a text is.
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.
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.
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.
Example
{ "storage": "db"}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"}No such review item in this project
object
Example generated
{ "error": "example"}The item is decided, or it already has 20 pictures (or 10 texts, for a text)
object
Example generated
{ "error": "example"}A picture 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 — it needs the project’s bucket; a text in a charset other than UTF-8; or bytes that are not UTF-8 text
object
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.
object
Example generated
{ "error": "example"}Headers
Section titled “Headers ”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)
object
Example generated
{ "error": "example"}