Patch a file

Contents

Patch a file by using file-id. This API updates the file metadata.

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

Request Syntax


POST /v2/files/:id/patch



Request Headers

Parameter Description Required
Authorization An access token with nas_read_write scope as well as a File Permission with value WriteFile or FileOwner for the file or a parent.

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

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

Value of type: string
false


Request Path Parameters

Parameter Description Required
id The ID of the file to update.

Value of type: string
true


Request Body

Parameter Description Required
cTime The file creation time.

Value of type: dateTime
false
hidden Which OS the file is hidden on. Possible values mac, linux, windows or none.

Value of type: string
false
mimeType The Media Type of the file. Use application/x.wd.dir for directories.

Value of type: string
false
mTime The file modification time.

Value of type: dateTime
false
name The name of the file.

Value of type: string
false
parentID The parent ID or the alias root.

Value of type: string
false


204 Response

The normal case will be 204.

Response Headers

Parameter Description Required
ETag An eTag (entity tag) is an HTTP response header used to determine the change in file metadata and content.

Value of type: string
false


Example

Sample request to patch a file.

Request


POST /sdk/v2/files/f2v8O8_JI70OY4SlIQME7Hr65MoBGKQPi686Qa3w/patch HTTP/1.1
Host: Endpoint-URL
Authorization: Bearer 9e9d3d16-f9b1-43dc-8599-d1db6fcedfa9
Content-Type: application/json
{
  "parentID": "NewParentID"
}

Response


HTTP/1.1 204 No Content
Etag: "Bg"
Vary: Origin
Date: Mon, 29 Aug 2016 22:03:29 GMT

Have question about this section?