Skip to content

The bytes are in the bucket — step 3 of 3 of sending a file to it

POST
/v1/files/{id}/complete
curl --request POST \
--url https://beta-api.plune.ai/v1/files/example/complete \
--header 'Authorization: Bearer <token>'

After POST /v1/results/{id}/files/uploads handed out the link and the client PUT the bytes to it. Plune asks the bucket (HEAD, through its guarded request) for the object: if it is there with the size and the type that were announced, the file is finished — from now on it is in the result’s files; if it is not, or it differs, the object is deleted (if there is one), the file is forgotten and the answer is 422: announce it again to try again. No body. Calling it again for a finished file answers 200 with the same body and does not ask the bucket again, so a client may repeat a call whose answer it did not hear. A bucket Plune cannot reach answers 503 bucket_unreachable and leaves the file waiting, so the same call can be repeated; a file nobody finishes is removed after an hour, and a call made after that hour is answered 410 upload_expired: announce the file again. On AWS S3 a key without s3:ListBucket is answered 403, not 404, for an object that is not there: complete takes that for a bucket it cannot read and answers 503. Someone else’s file is a 404, the same as an invented one. A reader of the project cannot finish a file. 3000 requests a minute a person.

id
required
string

The id of the entry that uploads answered with.

The file is finished

Media type application/json

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
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, GET /v1/files/{id} returns them. bucket: they are in the project’s own bucket, and GET /v1/files/{id} answers 409 in_bucket (the way to read them is GET /v1/files/{id}/link).

string
Allowed values: db bucket
Example
{
"storage": "db"
}

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 (or a file Plune keeps itself, which has nothing to finish)

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

The project has no bucket any more, so there is nothing to look in (code: not_connected)

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

The file was announced more than an hour ago and is not finished: the link has expired and the nightly sweep may be removing its object (code: upload_expired). Start again with uploads

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

What is in the bucket is not what was announced: code: file_missing (no object) or file_mismatch (another size or type — the object was deleted). The file is forgotten either way

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 bucket could not be reached (code: bucket_unreachable), or the server cannot open the key of the project (code: platform_not_configured). The file keeps waiting: repeat the call

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