Upload new file revision
A request to upload a new file revision meta.
POST /api/v1/files/{fileId}/upload
- Path parameters
| Parameter | Description |
|---|---|
fileId | The ID of the file. |
- Response structure
| Path | Type | Description |
|---|---|---|
file | Object | File object metadata |
links | Array | Array of links to file object. See File Links |
file.id | String | The ID of the file. |
file.filename | String | The name of the file. |
file.mediaType | String | The media type of the file. |
file.createdDate | Date | Create time for this file (formatted ISO8601 timestamp) |
file.fileSize | Number | The size of the file in bytes |
file.lastModifyingUserId | String | The ID of the user who last modified the file |
file.lastModifyingUserFsId | String | The FS ID of the user who last modified the file |
file.lastModifyingUserFirstName | String | The first name of the user who last modified the file |
file.lastModifyingUserMiddleName | String | The middle name of the user who last modified the file |
file.lastModifyingUserLastName | String | The last name of the user who last modified the file |
file.modifiedByMeDate | Date | Last time this file was modified by the user (formatted RFC 3339 timestamp) |
file.autoCreationRevisions | Boolean | Should new version of file be created automatically during collaboration |
file.lastViewedByMeDate | Date | Last time this file was viewed by the user (formatted RFC 3339 timestamp) |
file.sharedWithMeDate | Date | Time at which this file was shared with the user (formatted RFC 3339 timestamp) |
file.modifiedDate | Date | Last time this file was modified by anyone (formatted RFC 3339 timestamp) |
file.parentId | String | The parent folder (parentReferenceId) which contains this file. The root has no parent |
file.creator | String | The original creator (userId) of this file |
file.creatorFsId | String | The FS ID of the user who create the file |
file.creatorFirstName | String | The first name of the user who create the file |
file.creatorMiddleName | String | The middle name of the user who create the file |
file.creatorLastName | String | The last name of the user who create the file |
file.properties | Array | The list of file’s properties |
file.checksum | String | An MD5 checksum for the content of this file |
file.headRevisionId | String | The ID of the file’s head (last) revision |
file.isVersion | Boolean | The file is version or not |
file.prerender | String | The id of prerendered file |
file.preview | String | The id of preview file |
file.previewFailureMark | Date | Flag to show unix time of unsuccessful preview generation |
file.prerenderFailureMark | Date | Flag to show unix time of unsuccessful prerender generation |
file.thumbnailFailureMark | Date | Flag to show unix time of unsuccessful thumbnail generation |
file.ownerId | String | The owner (userId) of this file |
file.etag | String | ETag (HTTP Entity Tag) of the file |
file.ownerFsId | String | The owner (userId) of this file |
file.publicLinkId | String | Public link id [Since 2021.03] |
file.tree | String | Absolute path to this file for current user. Set of parent’s names and name of the file |
file.ownerFirstName | String | The owner first name of this file |
file.ownerLastName | String | The owner last name of this file |
file.ownerMiddleName | String | The owner middle name of this file |
file.totalSize | Number | Total size of all file’s versions |
file.currentRevisionObject | Object | Current revision object. See Get file revision |
file.previewClientVersion | String | Version of preview client that generated preview |
file.specialDir | String | Type of special folder, if present |
file.originalFileIdOpt | String | Exist only for version and contained file id |
file.creatorIsDeleted | Boolean | Show that creator is deleted |
file.editorIsDeleted | Boolean | Show that editor is deleted |
file.ownerIsDeleted | Boolean | Show that owner is deleted |
file.ownerAvatar | String | Owner avarat |
file.creatorAvatar | String | Creator avatar |
file.editorAvatar | String | Editor avatar |
file.oldPath | String | Old file path |
file.parentFolderName | String | The name of the parent folder |
file.properties[].id | String | The file’s property id |
file.properties[].key | String | The file’s property key |
file.properties[].value | String | The file’s property value |
links[].rel | String | Link type |
links[].href | String | Link reference |
- Example request
curl 'http://localhost:8080/api/v1/files/189395629/upload' -i \
-X POST \
-H 'Content-Type: multipart/form-data' \
-H 'X-co-auth-token: 0912abf38257a6845dc4585a15db70ec' \
-F 'file=@testfile.txt;type=text/plain'
- Example response
HTTP/1.1 200 OK
X-co-request-id: 7768643678654d657154427330686e6f
Content-Type: application/vnd.ncloudtech.cloudoffice.file+json;v=1;charset=UTF-8
Content-Length: 2399
{
"file": {
"id": "189395629",
"createdDate": "2022-04-06T16:00:27.000Z",
"creator": "testsrvdocs@tacos.devoffice.ru",
"creatorFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"creatorFirstName": "r",
"creatorLastName": "t",
"creatorMiddleName": "f",
"fileSize": "20",
"filename": "testfile.txt",
"headRevisionId": "189395979",
"lastModifyingUserId": "testsrvdocs@tacos.devoffice.ru",
"lastModifyingUserFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"lastModifyingUserFirstName": "r",
"lastModifyingUserLastName": "t",
"lastModifyingUserMiddleName": "f",
"mediaType": "text/plain",
"modifiedByMeDate": "2022-04-06T16:00:27.000Z",
"modifiedDate": "2022-04-06T16:00:27.000Z",
"ownerFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"ownerId": "testsrvdocs@tacos.devoffice.ru",
"parentId": "189395564",
"properties": [
{
"id": "sharedParent",
"key": "sharedParent",
"value": "true"
}
],
"totalSize": "41",
"checksum": "e0e102b9ff40785fac8902d8bcbf2279",
"tree": "/docs-test-uploadNewFileRevisionExample()-VNxcS2JT44/testfile.txt",
"ownerFirstName": "r",
"ownerLastName": "t",
"ownerMiddleName": "f",
"isVersion": false,
"originalFileIdOpt": null,
"creatorIsDeleted": false,
"editorIsDeleted": false,
"ownerIsDeleted": false,
"ownerAvatar": "",
"creatorAvatar": "",
"editorAvatar": ""
},
"links": [
{
"rel": "self",
"href": "http://localhost:8080/api/v1/files/189395629"
},
{
"rel": "download",
"href": "http://localhost:8080/api/v1/files/189395629/content"
},
{
"rel": "import",
"href": "http://localhost:8080/api/v1/files/189395629/import"
},
{
"rel": "preview",
"href": "http://localhost:8080/api/v1/files/189395629/preview"
},
{
"rel": "link",
"href": "http://localhost:8080/link/189395629"
}
]
}