Patch a file
April 2019 - changing POST method in favor of new PATCH method /v2/files/:id
Click here to see impacted APIs
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 be204.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.1Host: Endpoint-URLAuthorization: Bearer 9e9d3d16-f9b1-43dc-8599-d1db6fcedfa9Content-Type: application/json{ "parentID": "NewParentID"}
Response
HTTP/1.1 204 No ContentEtag: "Bg"Vary: OriginDate: Mon, 29 Aug 2016 22:03:29 GMT