Finish a chunked upload
const url = 'https://work.optidata.cloud/api/drives/1/nodes/chunk/finish';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"node_id":665198,"fileHash":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"}'};
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/finish \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "node_id": 665198, "fileHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" }'Assembles the uploaded chunks into the file’s content. Pass fileHash to
have the server verify the assembled file end to end; a mismatch fails
the call and leaves the node without content.
Retrying the call after a lost response is safe once the first call
has returned or been refused with 423. If the first call stored a
fileHash, a retry with that same fileHash answers 200 with the
node’s current state and writes nothing; a different or missing
fileHash answers 409. A first call sent without fileHash stores
none, so its retry always answers 409.
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”object
The node returned by the prepare step.
SHA-256 of the whole file, for verification.
Examples
{ "node_id": 665198, "fileHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"}Responses
Section titled “ Responses ”The completed node.
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 content was already committed by an earlier finish, and the
fileHash sent is different from the committed one or missing, or the
earlier finish stored no fileHash. Nothing was written. When the
earlier finish stored a fileHash, a retry with that same fileHash
answers 200 with the node’s current state.
Envelope of the domain errors the Drive services raise.
object
Human-readable description of the failure, in the caller’s language.
The HTTP status, repeated in the body.
Extra detail, often empty.
Examples
{ "error": "This content was already committed with different data.", "status": 409, "help": ""}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." ] }}Another write of the same file held it for longer than this write
waits (30 seconds by default), or the write could not keep its turn
(the server lost its hold on the file before writing). Writes that
wait for a turn are the ones carrying a base_content_hash and every
chunk finish. The base, if any, was not checked and nothing was
written: retry the same request after the number of seconds in
Retry-After; read the header rather than assume a fixed delay.
Envelope of the domain errors the Drive services raise.
object
Human-readable description of the failure, in the caller’s language.
The HTTP status, repeated in the body.
Extra detail, often empty.
Examples
{ "error": "Another save of this file is in progress. Try again in a moment.", "status": 423, "help": ""}Headers
Section titled “Headers”Example
5Seconds to wait before retrying the request (configurable on the server).
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."}