Create a resumable file starting from an existing file


Create a resumable file starting from an existing file.

Endpoint URL: {network.internalDNSName or network.proxyURL} received in DeviceInformation

Concurrent Access

When multiple users are interacting with the system simultaneously, it's your responsibility to maintain data integrity while making concurrent writes to resumable files. When you are using resumable files non-concurrently, it is recommended to use ETags always.

Request Syntax

POST /v2/files/:id/resumable


Request Headers

ParameterDescriptionRequired
AuthorizationAn access token with nas_read_write scope as well as the File Permission with value WriteFile or FileOwner for the file or a parent.

Value of type: string
true
If-MatchA previous response ETag or *. Return the object only if its entity tag (ETag) is the same as the one specified.

Value of type: string
false
If-None-MatchA previous response ETag or *. Return the object only if its entity tag (ETag) is different from the one specified.

Value of type: string
false


Request Path Parameters

ParameterDescriptionRequired
idThe resumable file ID.

Value of type: string
true


Request Query Parameters

ParameterDescriptionRequired
doneWhether to commit the file after having written its content.

Value of type: boolean

Default: false
false
offsetThe offset in the resumable file where to start writing the content. If not zero, the file will be sparse up to this offset.

Value of type: integer

Default: 0
false
truncateWhether to truncate the file after having written the content.

Value of type: boolean

Default: false
false


201 Response

The normal case will be 201.

Response Headers

ParameterDescriptionRequired
ETagThe ETag for the resumable file. It is used to determine the change in file metadata and content.

Value of type: string
false
LocationA relative URL to the created resumable file's endpoint.

Value of type: string
false


Example

Sample request to create a resumable file starting from an existing File.

Request

POST /sdk/v2/files/f2v8O8_JI70OY4SlIQME7Hr65MoBGKQPi686Qa3w/resumable?done=false&truncate=false&offset=10 HTTP/1.1Host: Endpoint-URLAuthorization: Bearer 9e9d3d16-f9b1-43dc-8599-d1db6fcedfa9Content-Length: 20Content-Type: application/x-www-form-urlencoded

Response

HTTP/1.1 201 No ContentEtag: "BA"Location: /sdk/v2/files/kBAk7fbgO5FbDRvA_O9hu4_iV9yeIT6UNvNf1i6_/resumableVary: OriginDate: Mon, 29 Aug 2016 21:59:31 GMT