Path - Update

Append Data | Flush Data | Set Properties | Set Access Control
Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a file or directory, or sets access control for a file or directory. Data can only be appended to a file. Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional HTTP requests. For more information, see Specifying Conditional Headers for Blob Service Operations.

PATCH https://{accountName}.{dnsSuffix}/{filesystem}/{path}?action={action}
PATCH https://{accountName}.{dnsSuffix}/{filesystem}/{path}?action={action}&position={position}&retainUncommittedData={retainUncommittedData}&close={close}&mode={mode}&maxRecords={maxRecords}&forceFlag={forceFlag}&continuation={continuation}&flush={flush}&timeout={timeout}

URI Parameters

Name In Required Type Description
accountName
path True

string

The Azure Storage account name.

dnsSuffix
path True

string

The DNS suffix for the Azure Data Lake Storage endpoint.

filesystem
path True

string

The filesystem identifier.

Regex pattern: ^[$a-z0-9](?!.*--)[-a-z0-9]{1,61}[a-z0-9]$

path
path True

string

The file or directory path.

action
query True

PathUpdateAction

The action must be "append" to upload data to be appended to a file, "flush" to flush previously uploaded data to a file, "setProperties" to set the properties of a file or directory, or "setAccessControl" to set the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to set the access control list for a directory recursively. Note that Hierarchical Namespace must be enabled for the account in order to use access control. Also note that the Access Control List (ACL) includes permissions for the owner, owning group, and others, so the x-ms-permissions and x-ms-acl request headers are mutually exclusive.

close
query

boolean

Azure Storage Events allow applications to receive notifications when files change. When Azure Storage Events are enabled, a file changed event is raised. This event has a property indicating whether this is the final change to distinguish the difference between an intermediate flush to a file stream and the final close of a file stream. The close query parameter is valid only when the action is "flush" and change notifications are enabled. If the value of close is "true" and the flush operation completes successfully, the service raises a file change notification with a property indicating that this is the final update (the file stream has been closed). If "false" a change notification is raised indicating the file has changed. The default is false. This query parameter is set to true by the Hadoop ABFS driver to indicate that the file stream has been closed."

continuation
query

string

Optional and valid only for "setAccessControlRecursive" operation. The number of paths processed with each invocation is limited. If the number of paths to be processed exceeds this limit, a continuation token is returned in the response header x-ms-continuation. When a continuation token is returned in the response, it must be percent-encoded and specified in a subsequent invocation of setAccessControlRecursive operation.

flush
query

boolean

Valid only for append calls. This parameter allows the caller to flush during an append call. Default value is "false" , if "true" the data will be flushed with the append call. Note that when using flush=true, the following headers are not supported - "x-ms-cache-control", "x-ms-content-encoding", "x-ms-content-type", "x-ms-content-language", "x-ms-content-md5", "x-ms-content-disposition". To set these headers during flush, please use action=flush

forceFlag
query

boolean

Optional and valid only for "setAccessControlRecursive" operation. If this is "false" operation will terminate fast on encountering user errors (4XX). If "true" the api will ignore user errors and proceed with the operation on other sub-entities of the directory. Detailed status of user errors will be returned in the response for either scenario. Continuation token will only be returned when forceFlag is "true" in case of user errors. Default value for forceFlag is false.

maxRecords
query

integer

int32

Optional and valid only for "setAccessControlRecursive" operation. It specifies the maximum number of files or directories on which the acl change will be applied. If omitted or greater than 2,000, the request will process up to 2,000 items

mode
query

string

Optional. Valid and required for "setAccessControlRecursive" operation. Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access control rights that were present earlier on files and directories

position
query

integer

int64

This parameter allows the caller to upload data in parallel and control the order in which it is appended to the file. It is required when uploading data to be appended to the file and when flushing previously uploaded data to the file. The value must be the position where the data is to be appended. Uploaded data is not immediately flushed, or written, to the file. To flush, the previously uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all data has been written, and there must not be a request entity body included with the request.

retainUncommittedData
query

boolean

Valid only for flush operations. If "true", uncommitted data is retained after the flush operation completes; otherwise, the uncommitted data is deleted after the flush operation. The default is false. Data at offsets less than the specified position are written to the file when flush succeeds, but this optional parameter allows data after the flush position to be retained for a future flush operation.

timeout
query

integer

int32

An optional operation timeout value in seconds. The period begins when the request is received by the service. If the timeout value elapses before the operation completes, the operation fails.

Request Header

Media Types: "application/octet-stream", "text/plain"

Name Required Type Description
Content-Length

integer

int64

Required for "Append Data" and "Flush Data". Must be 0 for "Flush Data". Must be the length of the request content in bytes for "Append Data".

Content-MD5

string

Optional. An MD5 hash of the request content. This header is valid on "Append" and "Flush" operations. This hash is used to verify the integrity of the request content during transport. When this header is specified, the storage service compares the hash of the content that has arrived with this header value. If the two hashes do not match, the operation will fail with error code 400 (Bad Request). Note that this MD5 hash is not stored with the file. This header is associated with the request content, and not with the stored content of the file itself.

x-ms-lease-id

string

The lease ID must be specified if there is an active lease. Invalid for "setAccessControlRecursive" operations.

Regex pattern: ^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$

x-ms-cache-control

string

Optional and only valid for flush and set properties operations. The service stores this value and includes it in the "Cache-Control" response header for "Read File" operations.

x-ms-content-type

string

Optional and only valid for flush and set properties operations. The service stores this value and includes it in the "Content-Type" response header for "Read File" operations.

x-ms-content-disposition

string

Optional and only valid for flush and set properties operations. The service stores this value and includes it in the "Content-Disposition" response header for "Read File" operations.

x-ms-content-encoding

string

Optional and only valid for flush and set properties operations. The service stores this value and includes it in the "Content-Encoding" response header for "Read File" operations.

x-ms-content-language

string

Optional and only valid for flush and set properties operations. The service stores this value and includes it in the "Content-Language" response header for "Read File" operations.

x-ms-content-md5

string

Optional and only valid for "Flush and Set Properties" operations. The service stores this value and includes it in the "Content-Md5" response header for "Read and Get Properties" operations. If this property is not specified on the request, then the property will be cleared for the file. Subsequent calls to "Read and Get Properties" will not return this property unless it is explicitly set on that file again.

x-ms-properties

string

Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is a base64 encoded string. Note that the string may only contain ASCII characters in the ISO-8859-1 character set. Valid only for the setProperties operation. If the file or directory exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a conditional request with the E-Tag and include values for all properties.

x-ms-owner

string

Optional and valid only for the setAccessControl operation. Sets the owner of the file or directory.

x-ms-group

string

Optional and valid only for the setAccessControl operation. Sets the owning group of the file or directory.

x-ms-permissions

string

Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read (4), write (2), or execute (1) permission. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. The sticky bit is also supported and in symbolic notation, its represented either by the letter t or T in the final character-place depending on whether the execution bit for the others category is set or unset respectively (e.g. rwxrw-rw- with sticky bit is represented as rwxrw-rwT. A rwxrw-rwx with sticky bit is represented as rwxrw-rwt), absence of t or T indicates sticky bit not set. In 4-digit octal notation, its represented by 1st digit (e.g. 1766 represents rwxrw-rw- with sticky bit and 0766 represents rwxrw-rw- without sticky bit). Invalid in conjunction with x-ms-acl.

x-ms-acl

string

Optional and valid only for the setAccessControl and setAccessControlRecursive operations. Required for setAccessControlRecursive operation. Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries that fully replaces the existing access control list (ACL) in case of setAccessControl and "set" mode of setAccessControlRecursive. "modify" mode of setAccessControlRecursive updates the pre-existing ACLS. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". The scope must be "default" to indicate the ACE belongs to the default ACL for a directory; otherwise scope is implicit and the ACE belongs to the access ACL. There are four ACE types: "user" grants rights to the owner or a named user, "group" grants rights to the owning group or a named group, "mask" restricts rights granted to named users and the members of groups, and "other" grants rights to all users not found in any of the other entries. The user or group identifier is omitted for entries of type "mask" and "other". The user or group identifier is also omitted for the owner and owning group. The permission field is a 3-character sequence where the first character is 'r' to grant read access, the second character is 'w' to grant write access, and the third character is 'x' to grant execute permission. If access is not granted, the '-' character is used to denote that the permission is denied. For example, the following ACL grants read, write, and execute rights to the file owner and john.doe@contoso, the read right to the owning group, and nothing to everyone else: "user::rwx,user:john.doe@contoso:rwx,group::r--,other::---,mask=rwx". Invalid in conjunction with x-ms-permissions. "remove" mode of setAccessControlRecursive removes the pre-existing ACLs and should not contain permissions in the access control list specified : "user:john.doe@contoso:, mask:". "set" mode of setAccessControlRecursive sets the ACLs replacing the pre-existing ACLs of the scope specified and must contain all three - owning user, owning group and other info if access scope is getting set or if either of owning user, owning group or other is being set in default scope. "set" and "modify" modes of setAccessControlRecursive must contain permissions as part of access control list.

If-Match

string

Optional for Flush Data, Set Access Control and Set Properties, but invalid for Append Data and Set Access Control Recursive. An ETag value. Specify this header to perform the operation only if the resource's ETag matches the value specified. The ETag must be specified in quotes.

If-None-Match

string

Optional for Flush Data, Set Access Control and Set Properties, but invalid for Append Data and Set Access Control Recursive. An ETag value or the special wildcard ("*") value. Specify this header to perform the operation only if the resource's ETag does not match the value specified. The ETag must be specified in quotes.

If-Modified-Since

string

Optional for Flush Data and Set Properties, but invalid for Append Data and Set Access Control Recursive. A date and time value. Specify this header to perform the operation only if the resource has been modified since the specified date and time.

If-Unmodified-Since

string

Optional for Flush Data and Set Properties, but invalid for Append Data and Set Access Control Recursive. A date and time value. Specify this header to perform the operation only if the resource has not been modified since the specified date and time.

x-ms-encryption-key

string

Optional. The Base64-encoded AES-256 encryption key.

x-ms-encryption-key-sha256

string

Optional. The Base64-encoded SHA256 hash of the encryption key.

x-ms-encryption-algorithm: AES256

string

Optional. Specifies the algorithm to use for encryption. The value of this header must be AES256.

x-ms-lease-action True

PathLeaseAction

Starting with version 2020-08-04 in append and flush operations. Append supports 'acquire', 'auto-renew' and 'acquire-release' action. If 'acquire' it will acquire the lease. If 'auto-renew' it will renew the lease. If 'acquire-release' it will acquire & complete the operation & release the lease once operation is done. 'Release' action is only supported in flush operation. If 'true', will release the lease on the file using the lease id info from x-ms-lease-id header.

x-ms-lease-duration

integer

int32

The lease duration is required to acquire a lease, and specifies the duration of the lease in seconds. The lease duration must be between 15 and 60 seconds or -1 for infinite lease.

x-ms-proposed-lease-id

string

Required when "x-ms-lease-action" is "acquire" or "change". A lease will be acquired with this lease ID if the operation is successful.

Regex pattern: ^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$

x-ms-client-request-id

string

A UUID recorded in the analytics logs for troubleshooting and correlation.

Regex pattern: ^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$

x-ms-date

string

Specifies the Coordinated Universal Time (UTC) for the request. This is required when using shared key authorization.

x-ms-version

string

Specifies the version of the REST protocol used for processing the request. This is required when using shared key authorization.

Request Body

Media Types: "application/octet-stream", "text/plain"

Name Type Description
requestBody

object

Valid only for append operations. The data to be uploaded and appended to the file.

Responses

Name Type Description
200 OK

SetAccessControlRecursiveResponse

The data was flushed (written) to the file or the properties were set successfully. Response body is optional and is valid only for "SetAccessControlRecursive"

Headers

  • Date: string
  • ETag: string
  • Last-Modified: string
  • Accept-Ranges: string
  • Cache-Control: string
  • Content-Disposition: string
  • Content-Encoding: string
  • Content-Language: string
  • Content-Length: integer
  • Content-Range: string
  • Content-Type: string
  • Content-MD5: string
  • x-ms-properties: string
  • x-ms-continuation: string
  • x-ms-request-id: string
  • x-ms-version: string
  • x-ms-request-server-encrypted: true/false: boolean
  • x-ms-encryption-key-sha256: string
  • x-ms-encryption-scope: string
  • x-ms-lease-renewed: boolean
202 Accepted

The uploaded data was accepted.

Headers

  • Content-MD5: string
  • Date: string
  • x-ms-request-id: string
  • x-ms-version: string
  • x-ms-lease-renewed: boolean
Other Status Codes

DataLakeStorageError

An error occurred. The possible HTTP status, code, and message strings are listed below:

  • 400 Bad Request, ContentLengthMustBeZero, "The Content-Length request header must be zero."
  • 400 Bad Request, InvalidAuthenticationInfo, "Authentication information is not given in the correct format. Check the value of Authorization header."
  • 400 Bad Request, InvalidFlushPosition, "The uploaded data is not contiguous or the position query parameter value is not equal to the length of the file after appending the uploaded data."
  • 400 Bad Request, InvalidHeaderValue, "The value for one of the HTTP headers is not in the correct format."
  • 400 Bad Request, InvalidHttpVerb, "The HTTP verb specified is invalid - it is not recognized by the server."
  • 400 Bad Request, InvalidInput, "One of the request inputs is not valid."
  • 400 Bad Request, InvalidPropertyName, "A property name cannot be empty."
  • 400 Bad Request, InvalidPropertyName, "The property name contains invalid characters."
  • 400 Bad Request, InvalidQueryParameterValue, "Value for one of the query parameters specified in the request URI is invalid."
  • 400 Bad Request, InvalidResourceName, "The specified resource name contains invalid characters."
  • 400 Bad Request, InvalidSourceUri, "The source URI is invalid."
  • 400 Bad Request, InvalidUri, "The request URI is invalid."
  • 400 Bad Request, MissingRequiredHeader, "An HTTP header that's mandatory for this request is not specified."
  • 400 Bad Request, MissingRequiredQueryParameter, "A query parameter that's mandatory for this request is not specified."
  • 400 Bad Request, MultipleConditionHeadersNotSupported, "Multiple condition headers are not supported."
  • 400 Bad Request, OutOfRangeInput, "One of the request inputs is out of range."
  • 400 Bad Request, OutOfRangeQueryParameterValue, "One of the query parameters specified in the request URI is outside the permissible range."
  • 400 Bad Request, UnsupportedHeader, "One of the headers specified in the request is not supported."
  • 400 Bad Request, UnsupportedQueryParameter, "One of the query parameters specified in the request URI is not supported."
  • 400 Bad Request, UnsupportedRestVersion, "The specified Rest Version is Unsupported."
  • 403 Forbidden, AccountIsDisabled, "The specified account is disabled."
  • 403 Forbidden, AuthorizationFailure, "This request is not authorized to perform this operation."
  • 403 Forbidden, InsufficientAccountPermissions, "The account being accessed does not have sufficient permissions to execute this operation."
  • 404 Not Found, FilesystemNotFound, "The specified filesystem does not exist."
  • 404 Not Found, PathNotFound, "The specified path does not exist."
  • 404 Not Found, RenameDestinationParentPathNotFound, "The parent directory of the destination path does not exist."
  • 404 Not Found, ResourceNotFound, "The specified resource does not exist."
  • 404 Not Found, SourcePathNotFound, "The source path for a rename operation does not exist."
  • 405 Method Not Allowed, UnsupportedHttpVerb, "The resource doesn't support the specified HTTP verb."
  • 409 Conflict, DestinationPathIsBeingDeleted, "The specified destination path is marked to be deleted."
  • 409 Conflict, DirectoryNotEmpty, "The recursive query parameter value must be true to delete a non-empty directory."
  • 409 Conflict, FilesystemAlreadyExists, "The specified filesystem already exists."
  • 409 Conflict, FilesystemBeingDeleted, "The specified filesystem is being deleted."
  • 409 Conflict, InvalidDestinationPath, "The specified path, or an element of the path, exists and its resource type is invalid for this operation."* 409 Conflict, InvalidFlushOperation, "The resource was created or modified by the Blob Service API and cannot be written to by the Data Lake Storage Service API."
  • 409 Conflict, InvalidRenameSourcePath, "The source directory cannot be the same as the destination directory, nor can the destination be a subdirectory of the source directory."
  • 409 Conflict, InvalidSourceOrDestinationResourceType, "The source and destination resource type must be identical."
  • 409 Conflict, LeaseAlreadyPresent, "There is already a lease present."
  • 409 Conflict, LeaseIdMismatchWithLeaseOperation, "The lease ID specified did not match the lease ID for the resource with the specified lease operation."
  • 409 Conflict, LeaseIsAlreadyBroken, "The lease has already been broken and cannot be broken again."
  • 409 Conflict, LeaseIsBreakingAndCannotBeAcquired, "The lease ID matched, but the lease is currently in breaking state and cannot be acquired until it is broken."
  • 409 Conflict, LeaseIsBreakingAndCannotBeChanged, "The lease ID matched, but the lease is currently in breaking state and cannot be changed."
  • 409 Conflict, LeaseIsBrokenAndCannotBeRenewed, "The lease ID matched, but the lease has been broken explicitly and cannot be renewed."
  • 409 Conflict, LeaseNameMismatch, "The lease name specified did not match the existing lease name."
  • 409 Conflict, LeaseNotPresentWithLeaseOperation, "The lease ID is not present with the specified lease operation."
  • 409 Conflict, PathAlreadyExists, "The specified path already exists."
  • 409 Conflict, PathConflict, "The specified path, or an element of the path, exists and its resource type is invalid for this operation."
  • 409 Conflict, SourcePathIsBeingDeleted, "The specified source path is marked to be deleted."
  • 409 Conflict, ResourceTypeMismatch, "The resource type specified in the request does not match the type of the resource."
  • 412 Precondition Failed, ConditionNotMet, "The condition specified using HTTP conditional header(s) is not met."
  • 412 Precondition Failed, LeaseIdMismatch, "The lease ID specified did not match the lease ID for the resource."
  • 412 Precondition Failed, LeaseIdMissing, "There is currently a lease on the resource and no lease ID was specified in the request."
  • 412 Precondition Failed, LeaseNotPresent, "There is currently no lease on the resource."
  • 412 Precondition Failed, LeaseLost, "A lease ID was specified, but the lease for the resource has expired."
  • 412 Precondition Failed, SourceConditionNotMet, "The source condition specified using HTTP conditional header(s) is not met."
  • 413 Request Entity Too Large, RequestBodyTooLarge, "The request body is too large and exceeds the maximum permissible limit."
  • 416 Requested Range Not Satisfiable, InvalidRange, "The range specified is invalid for the current size of the resource."
  • 500 Internal Server Error, InternalError, "The server encountered an internal error. Please retry the request."
  • 500 Internal Server Error, OperationTimedOut, "The operation could not be completed within the permitted time."
  • 503 Service Unavailable, ServerBusy, "Egress is over the account limit."
  • 503 Service Unavailable, ServerBusy, "Ingress is over the account limit."
  • 503 Service Unavailable, ServerBusy, "Operations per second is over the account limit."
  • 503 Service Unavailable, ServerBusy, "The server is currently unable to receive requests. Please retry your request."

Headers

  • x-ms-request-id: string
  • x-ms-version: string

Definitions

Name Description
AclFailedEntryList
DataLakeStorageError
Error

The service error response object.

PathLeaseAction

Starting with version 2020-08-04 in append and flush operations. Append supports 'acquire', 'auto-renew' and 'acquire-release' action. If 'acquire' it will acquire the lease. If 'auto-renew' it will renew the lease. If 'acquire-release' it will acquire & complete the operation & release the lease once operation is done. 'Release' action is only supported in flush operation. If 'true', will release the lease on the file using the lease id info from x-ms-lease-id header.

PathUpdateAction

The action must be "append" to upload data to be appended to a file, "flush" to flush previously uploaded data to a file, "setProperties" to set the properties of a file or directory, or "setAccessControl" to set the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to set the access control list for a directory recursively. Note that Hierarchical Namespace must be enabled for the account in order to use access control. Also note that the Access Control List (ACL) includes permissions for the owner, owning group, and others, so the x-ms-permissions and x-ms-acl request headers are mutually exclusive.

SetAccessControlRecursiveResponse

AclFailedEntryList

Name Type Description
errorMessage

string

name

string

type

string

DataLakeStorageError

Name Type Description
error

Error

The service error response object.

Error

The service error response object.

Name Type Description
code

string

The service error code.

message

string

The service error message.

PathLeaseAction

Starting with version 2020-08-04 in append and flush operations. Append supports 'acquire', 'auto-renew' and 'acquire-release' action. If 'acquire' it will acquire the lease. If 'auto-renew' it will renew the lease. If 'acquire-release' it will acquire & complete the operation & release the lease once operation is done. 'Release' action is only supported in flush operation. If 'true', will release the lease on the file using the lease id info from x-ms-lease-id header.

Name Type Description
acquire

string

acquire-release

string

auto-renew

string

release

string

PathUpdateAction

The action must be "append" to upload data to be appended to a file, "flush" to flush previously uploaded data to a file, "setProperties" to set the properties of a file or directory, or "setAccessControl" to set the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to set the access control list for a directory recursively. Note that Hierarchical Namespace must be enabled for the account in order to use access control. Also note that the Access Control List (ACL) includes permissions for the owner, owning group, and others, so the x-ms-permissions and x-ms-acl request headers are mutually exclusive.

Name Type Description
append

string

flush

string

setAccessControl

string

setAccessControlRecursive

string

setProperties

string

SetAccessControlRecursiveResponse

Name Type Description
directoriesSuccessful

integer

failedEntries

AclFailedEntryList[]

failureCount

integer

filesSuccessful

integer