Palbase Storage · API
/storage/buckets/{bucket}Declare a bucket
Creates the bucket as declared, or makes it so: whether anyone may read it (public), the largest object it takes, the content types it takes (empty: any; image/* a family), and the renditions made of every picture put in it. A declaration a renderer cannot honour is refused here, not at the first upload. With If-None-Match: * it only creates the bucket: two clients making the same bucket at once do not overwrite each other's declaration — the second is told (412) and the bucket stays as the first made it.
Called by your server, with the project's secret key.
Path
bucketstring · requiredThe bucket's name: a lowercase letter, then lowercase letters, digits and -, 2 to 63 characters.Headers
Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.If-None-Match"*" · optional* alone: create the bucket only if it does not exist (412 `precondition_failed` when it does, the bucket as it was). Without it the declaration creates the bucket or makes it so.Request body
allowed_mime_typesstring[] · optionalThe content types it takes; empty or absent: any. image/* names a family. 64 at most.file_size_limitinteger (int64) · optionalThe largest object it takes, in bytes (1 to 5 GiB); null or absent: the platform's.publicboolean · optionalWhether anyone may read its objects at /storage/public/. Absent: false.variantsobject[] · optionalThe renditions made of every picture put in it; 16 at most.curl -X PUT "https://<your-ref>.palbase.studio/storage/buckets/<bucket>" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"allowed_mime_types":["string"],"file_size_limit":0,"public":false,"variants":[{"name":"string"}]}'Responses
200The bucket, changed
201The bucket, created
400The request is malformed: a field, a path or a parameter is wrong
401No key, or not a key of this project (the edge's answer)
403Not the project's secret key; or, on a credential-less route, a private object or a link that is not valid for it
409The bucket still holds objects, an object is already at the destination, or a request with this Idempotency-Key is still running
412If-None-Match: * and the bucket exists already (`precondition_failed`): it was left as it was
422A picture this storage cannot decode, or an Idempotency-Key sent with a different request
429The project's request rate, or its storage quota for the period, is used up — or, slowed for its month's traffic, it has as many downloads under way as are paced at once; Retry-After says when to try again
503The platform could not answer now; retrying is safe (Retry-After)
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation PutBucket of storage's contract.