Upload one chunk
const url = 'https://work.optidata.cloud/api/drives/1/nodes/chunk/upload';const form = new FormData();form.append('node_id', '1');form.append('chunkData', 'example');form.append('chunkNumber', '1');form.append('chunkHash', 'example');form.append('asBase64', 'true');form.append('name', 'example');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
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://work.optidata.cloud/api/drives/1/nodes/chunk/upload \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form node_id=1 \ --form chunkData=example \ --form chunkNumber=1 \ --form chunkHash=example \ --form asBase64=true \ --form name=exampleSends a single chunk of a prepared upload. Chunks are numbered from 1
and may be sent in any order. Pass chunkHash to have the server verify
the chunk on arrival.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Numeric id of the drive. Read it from GET /drives/config.json.
Request Bodyrequired
Section titled “Request Bodyrequired”One chunk of an upload that creates a new file.
object
The node returned by the prepare step.
The chunk itself — raw bytes as a multipart part, or base64 when
asBase64 is set.
Position of this chunk, counting from 1.
SHA-256 of the chunk, for verification on arrival.
Set when chunkData is base64 encoded.
Original file name, kept for diagnostics.
One chunk of an upload that creates a new file.
object
The node returned by the prepare step.
The chunk itself — raw bytes as a multipart part, or base64 when
asBase64 is set.
Position of this chunk, counting from 1.
SHA-256 of the chunk, for verification on arrival.
Set when chunkData is base64 encoded.
Original file name, kept for diagnostics.
Examplegenerated
{ "node_id": 1, "chunkData": "example", "chunkNumber": 1, "chunkHash": "example", "asBase64": true, "name": "example"}Responses
Section titled “ Responses ”The chunk was stored.
object
Examplegenerated
{}Missing, malformed or expired authentication key.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The caller lacks the permission level the operation requires.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "This action is unauthorized."}The resource does not exist, or does not belong to the given drive.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "No query results for model [App\\Models\\Node] 99999999"}The request body or query string failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The name field is required.", "errors": { "name": [ "The name field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}