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 |
---|---|---|---|---|
account
|
path | True |
string |
The Azure Storage account name. |
dns
|
path | True |
string |
The DNS suffix for the Azure Data Lake Storage endpoint. |
filesystem
|
path | True |
string |
The filesystem identifier. Regex pattern: |
path
|
path | True |
string |
The file or directory path. |
action
|
query | True |
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 |
|
force
|
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. |
|
max
|
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. |
|
retain
|
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: |
|
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 |
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: |
|
x-ms-client-request-id |
string |
A UUID recorded in the analytics logs for troubleshooting and correlation. Regex pattern: |
|
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 |
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
|
|
202 Accepted |
The uploaded data was accepted. Headers
|
|
Other Status Codes |
An error occurred. The possible HTTP status, code, and message strings are listed below:
Headers
|
Definitions
Name | Description |
---|---|
Acl |
|
Data |
|
Error |
The service error response object. |
Path |
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. |
Path |
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. |
Set |
AclFailedEntryList
Name | Type | Description |
---|---|---|
errorMessage |
string |
|
name |
string |
|
type |
string |
DataLakeStorageError
Name | Type | Description |
---|---|---|
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 | ||
failureCount |
integer |
|
filesSuccessful |
integer |