Skip to content

Finish a chunked upload

POST
/drives/{drive}/nodes/chunk/finish
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.

drive
required
integer format: int64

Numeric id of the drive. Read it from GET /drives/config.json.

Media typeapplication/json
object
node_id
required

The node returned by the prepare step.

integer format: int64
fileHash

SHA-256 of the whole file, for verification.

string | null
Examples
Examplefinish
{
"node_id": 665198,
"fileHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
}

The completed node.

Media typeapplication/json
object
key
additional properties
any
Examplegenerated
{}

Missing, malformed or expired authentication key.

Media typeapplication/json

Authentication failures use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The caller lacks the permission level the operation requires.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Exampledenied
{
"message": "This action is unauthorized."
}

The resource does not exist, or does not belong to the given drive.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplemissing
{
"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.

Media typeapplication/json

Envelope of the domain errors the Drive services raise.

object
error
required

Human-readable description of the failure, in the caller’s language.

string
status
required

The HTTP status, repeated in the body.

integer
help
required

Extra detail, often empty.

string
Examples
ExamplealreadyCommitted
{
"error": "This content was already committed with different data.",
"status": 409,
"help": ""
}

The request body or query string failed validation.

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Validation messages keyed by field name.

object
key
additional properties
Array<string>
Examples
Exampleinvalid
{
"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.

Media typeapplication/json

Envelope of the domain errors the Drive services raise.

object
error
required

Human-readable description of the failure, in the caller’s language.

string
status
required

The HTTP status, repeated in the body.

integer
help
required

Extra detail, often empty.

string
Examples
ExamplesaveInProgress
{
"error": "Another save of this file is in progress. Try again in a moment.",
"status": 423,
"help": ""
}
Retry-After
integer
Example
5

Seconds to wait before retrying the request (configurable on the server).

Rate limit exceeded. Retry after the window resets.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplethrottled
{
"message": "Too Many Attempts."
}