Palbase Storage · API
/storage/upload/{machine}/{route}Upload a file to an app's upload route
An app's upload route (@Upload): one call carrying a file and a JSON body, answered with what the app's completion handler returned. The app's machine authorizes it (the route's own auth, and the object's bucket and path), storage writes the bytes under the bucket's rules and measures them, then gives the app the object and the body; its answer is this call's, as the app gave it. A completion that refuses, or does not answer, deletes the object. The caller is named to the app (id, session, role); its token is never forwarded.
Called by a signed-in user of your app, with their token and the publishable key; or your app, with the publishable key.
Path
machinestring · requiredThe machine that runs the app's backend.routestring · requiredThe app's upload route as ONE percent-encoded segment: posts/photo is posts%2Fphoto. Segments separated by /, none empty, . or .. (after Unicode compatibility folding), no control character or backslash; 1 to 1024 bytes of UTF-8. Its query is the request's own.curl -X POST "https://<your-ref>.palbase.studio/storage/upload/<machine>/<route>" \
-H "apikey: $PALBASE_PUBLISHABLE_KEY" \
-H "authorization: Bearer $USER_ACCESS_TOKEN" \
-H "content-type: multipart/form-data" \
--data-binary @fileResponses
400Not an upload: not multipart, no file, a body that is not JSON, a route or machine that is none.
404No such machine, or the bucket the app named is none.
413Larger than the bucket takes.
415A type the bucket does not take.
429The project's storage is used up under its quota, or its machine calls are all under way.
502The app did not answer, or its authorize named no object.
503The machine is waking or building, or this storage reaches no machine; retrying is safe.
defaultThe app's completion handler's answer, as it gave it; or the app's authorize's refusal, as it gave it.
Operation Upload of storage's contract.