Skip to main content

Set file properties

A request to set file properties.

Заметка

[Since 2017.01] It’s allowed to set custom properties which id/key is started with custom_ prefix

POST /api/v1/files/{fileId}/properties HTTP/1.1

Generates Notification metadata changed.

  1. Path parameters
ParameterDescription
fileIdThe ID of the file.
  1. Request structure
PathTypeDescription
[].idStringThe ID of the property.
[].keyStringThe key of this property.
[].valueStringThe value of this property. Use value="undef" for removing custom property
  1. Response structure
PathTypeDescription
[]ArrayArray of property objects.
[].linksArrayArray of links to file object. See File Links
[].property.idStringThe file’s property id.
[].property.keyStringThe file’s property key.
[].property.valueStringThe file’s property value.
[].links[].relStringLink type
[].links[].hrefStringLink reference
  1. Example request
curl 'http://localhost:8080/api/v1/files/189360784/properties' -i -X POST \
-H 'Content-Type: application/json' \
-H 'X-co-auth-token: b35642d88a3d3c2f896721f3b6999456' \
-d '[
{
"id": "flagged",
"key": "flagged",
"value": "true"
},
{
"id": "custom_my_1",
"key": "custom_my_1",
"value": "my custom value"
}
] '
  1. Example response
HTTP/1.1 200 OK
X-co-request-id: 74556b657155367a4166764731416a66
Content-Type: application/vnd.ncloudtech.cloudoffice.propertylist+json;v=1;charset=UTF-8
Content-Length: 411
[
{
"property": {
"id": "flagged",
"key": "flagged",
"value": "true"
},
"links": [
{
"rel": "self",
"href": "http://localhost:8080/api/v1/files/flagged"
}
]
},
{
"property": {
"id": "custom_my_1",
"key": "custom_my_1",
"value": "my custom value"
},
"links": [
{
"rel": "self",
"href": "http://localhost:8080/api/v1/files/custom_my_1"
}
]
}
]