Get file list
A request to list files.
POST /api/v1/files?q={query} HTTP/1.1
- Request parameters
| Parameter | Description |
|---|---|
q | Urlencoded query json object. See Query object structure |
withHasSubFolder | If flag is true, send hasChildFolders property in response. By default is true. hasChildFolders is true when file has sub folder(s), otherwise false |
Query object structure
| Field | Description |
|---|---|
parentId | contains parent folder id. |
mediaTypeForLogging | contains media type filter. |
sortField | describes field name from JSON File structure. Available values: filename, creator, ownerId, fileSize, modifiedDate, createdDate, modifiedByMeDate, sharedWithMeDate, lastViewedByMeDate |
sortOrder | describes order of sorting ('asc' - ascending, 'desc' - descending) |
searchQuery | contains search query string |
searchByContent | if true - search by content, if false - search by filename |
searchInShared | if true search in shared folder |
searchInCorporate | if true search in corporate folder |
offset | contains index of the first element |
limit | contains number of elements |
- Response structure
| Path | Type | Description |
|---|---|---|
[] | Array | Array of File objects. See Get file info |
[].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 versiobn 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 avatar |
[].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?q=%7B%22parentId%22%3A%22189373322%22%2C%22sortField%22%3A%22filename%22%2C%22sortOrder%22%3A%22asc%22%2C%22searchByContent%22%3Afalse%2C%22searchInShared%22%3Afalse%2C%22searchInCorporate%22%3Afalse%2C%22offset%22%3A-1%2C%22limit%22%3A-1%7D' -i -X GET \
-H 'X-co-auth-token: 1ac611c3016eb837f11ff29bdab2daa0'
- Example response
HTTP/1.1 200 OK
X-co-request-id: 4374556f31633332567973547654427a
Content-Type: application/vnd.ncloudtech.cloudoffice.filelist+json;v=1;charset=UTF-8
Content-Length: 4349
[
{
"file": {
"id": "189373377",
"createdDate": "2022-04-06T15:58:53.000Z",
"creator": "testsrvdocs@tacos.devoffice.ru",
"creatorFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"creatorFirstName": "r",
"creatorLastName": "t",
"creatorMiddleName": "f",
"fileSize": "null",
"filename": "New Folder",
"lastModifyingUserId": "testsrvdocs@tacos.devoffice.ru",
"lastModifyingUserFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"lastModifyingUserFirstName": "r",
"lastModifyingUserLastName": "t",
"lastModifyingUserMiddleName": "f",
"mediaType": "application/vnd.ncloudtech.cloudoffice.folder",
"modifiedByMeDate": "2022-04-06T15:58:53.000Z",
"modifiedDate": "2022-04-06T15:58:53.000Z",
"ownerFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"ownerId": "testsrvdocs@tacos.devoffice.ru",
"parentId": "189373322",
"properties": [
{
"id": "sharedParent",
"key": "sharedParent",
"value": "true"
}
],
"totalSize": "0",
"tree": "/docs-test-getFileListExample()-QgrfcT3y0S/New Folder/",
"ownerFirstName": "r",
"ownerLastName": "t",
"ownerMiddleName": "t",
"isVersion": false,
"originalFileIdOpt": null,
"creatorIsDeleted": false,
"editorIsDeleted": false,
"ownerIsDeleted": false,
"ownerAvatar": "a00bbb30-993e-4632-925f-152939195049",
"creatorAvatar": "a00bbb30-993e-4632-925f-152939195049",
"editorAvatar": "a00bbb30-993e-4632-925f-152939195049"
},
"links": [
{
"rel": "self",
"href": "http://localhost:8080/api/v1/files/189373377"
},
{
"rel": "link",
"href": "http://localhost:8080/link/189373377"
}
]
},
{
"file": {
"id": "189373442",
"createdDate": "2022-04-06T15:58:53.000Z",
"creator": "testsrvdocs@tacos.devoffice.ru",
"creatorFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"creatorFirstName": "r",
"creatorLastName": "t",
"creatorMiddleName": "f",
"fileSize": "20",
"filename": "testfile.txt",
"headRevisionId": "189373443",
"lastModifyingUserId": "testsrvdocs@tacos.devoffice.ru",
"lastModifyingUserFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"lastModifyingUserFirstName": "r",
"lastModifyingUserLastName": "t",
"lastModifyingUserMiddleName": "f",
"mediaType": "text/plain",
"modifiedByMeDate": "2022-04-06T15:58:53.000Z",
"modifiedDate": "2022-04-06T15:58:53.000Z",
"ownerFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"ownerId": "testsrvdocs@tacos.devoffice.ru",
"parentId": "189373322",
"properties": [
{
"id": "sharedParent",
"key": "sharedParent",
"value": "true"
}
],
"totalSize": "20",
"checksum": "e0e102b9ff40785fac8902d8bcbf2279",
"tree": "/docs-test-getFileListExample()-QgrfcT3y0S/testfile.txt",
"ownerFirstName": "r",
"ownerLastName": "t",
"ownerMiddleName": "f",
"isVersion": false,
"originalFileIdOpt": null,
"creatorIsDeleted": false,
"editorIsDeleted": false,
"ownerIsDeleted": false,
"ownerAvatar": "a00bbb30-993e-4632-925f-152939195049",
"creatorAvatar": "a00bbb30-993e-4632-925f-152939195049",
"editorAvatar": "a00bbb30-993e-4632-925f-152939195049"
},
"links": [
{
"rel": "self",
"href": "http://localhost:8080/api/v1/files/189373442"
},
{
"rel": "download",
"href": "http://localhost:8080/api/v1/files/189373442/content"
},
{
"rel": "import",
"href": "http://localhost:8080/api/v1/files/189373442/import"
},
{
"rel": "preview",
"href": "http://localhost:8080/api/v1/files/189373442/preview"
},
{
"rel": "link",
"href": "http://localhost:8080/link/189373442"
}
]
}
]