Retrieving Files Using Search Engine Capabilities
Function
You can search for files or folders in the cloud space by file name or type.
URI
POST /koodrive/ose/v1/files/search
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Traceid | No | String | Definition: Service trace ID, which contains 58 bits. Constraints: N/A Range: The value contains 58 bits. Default Value: N/A |
Authorization | Yes | String | Definition: Access token. Token authentication is used to call KooDrive APIs. A token indicates the permission. When an API is called, the token is added to the request header to obtain the operation permission. For details about how to obtain an access token, see the corresponding developer guide. The format is Bearer+{access_token}. Constraints: N/A Range: N/A Default Value: N/A |
language | No | String | Definition: Language code. Constraints: The value must comply with the internationalization specifications. For example, en_us indicates English (United States). Range: The value must comply with the internationalization specifications. Default Value: en-US |
X-User-Id | Yes | String | Definition: User ID on KooDrive, which is used for app authentication. Constraints: N/A Range: N/A Default Value: N/A |
X-Date | Yes | String | Definition: Date, which is used for app authentication. The format is yyyyMMdd'T'HHmmss'Z'. Constraints: The time must be within 15 minutes from the current time and cannot be later than the current time. Range: N/A Default Value: N/A |
x-hw-share-folder-id | No | String | Definition: ID of the shared folder. If this request header is passed, the current operation is performed in the shared folder. Constraints: N/A Range: N/A Default Value: N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
searchType | Yes | String | Definition: Query type. Constraints: N/A Range: Default Value: N/A |
pageInfo | Yes | PageInfo object | Definition: Pagination information. Constraints: N/A Range: N/A Default Value: N/A |
filter | No | filter object | Definition: Filter criterion. Constraints: N/A Range: N/A Default Value: N/A |
sortInfo | No | FileSortInfo object | Definition: Sorting information. Constraints: N/A Range: N/A Default Value: N/A |
recursived | No | Boolean | Definition: Whether files in sub-directories are queried recursively. Constraints: N/A Range: true or false Default Value: false |
imageProcess | No | String | Definition: Image operation, which can be used to specify the thumbnail size. Constraints: The length cannot exceed 300. Range: For details about the value, see https://support.huaweicloud.com/en-us/usermanual-obs/obs_01_0430.html. Default Value: image/resize,m_lfit,h_128,w_128 |
recycled | No | Boolean | Definition: Recycle bin query. Constraints: N/A Range: true or false Default Value: false |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
pageSize | No | Integer | Definition: Number of files on each page. Constraints: N/A Range: 1 to 100 Default Value: 100 |
pageCursor | No | String | Definition: Pagination start cursor. Constraints: N/A Range: N/A Default Value: N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
keyWord | No | String | Definition: File name. Constraints: The maximum length is 250. Range: N/A Default Value: N/A |
containerId | No | String | Definition: Space ID. Constraints: N/A Range: N/A Default Value: N/A |
parentFolder | No | String | Definition: Parent directory ID. Constraints: N/A Range: N/A Default Value: N/A |
fileType | No | String | Definition: File type. Constraints: N/A Range: 10: folder 11: smart folder (available only to whitelisted users) 15: image 20: video 26: Word file 27: Excel file 28: PowerPoint file 30: audio 35: compressed file 40: application 45: other Default Value: N/A |
sizeRange | No | String | Definition: File size range, in bytes. Constraints: The value is in the format of "minimum value,maximum value", for example, 10,200. Range: N/A Default Value: N/A |
updateTimeRange | No | String | Definition: Update time range. Constraints: Example: 2025-05-16 16:00:00,2025-05-18 15:59:59 Range: N/A Default Value: N/A |
ownerId | No | String | Definition: File owner ID. Constraints: N/A Range: N/A Default Value: N/A |
fileSuffixList | No | Array of strings | Definition: File name extension. Constraints: The list can contain a maximum of 100. Range: N/A Default Value: N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
sortType | No | Integer | Definition: Sort field. Constraints: N/A Range: 1: file name 2: file size 3: creation time 4: modification time 5: reclaim time (only for reclaimed files) 6: file format Default Value: N/A |
sortDirection | No | Integer | Definition: Sorting order. Constraints: N/A Range: 1: ascending 2: descending Default Value: N/A |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
code | Integer | Response code. 0 indicates success. Other values indicate failure. |
msg | String | Success and error information. |
files | Array of files objects | Search results |
total | Integer | Total number of records. |
nextPageCursor | String | Start cursor of the next page. It is null for the last page. |
Parameter | Type | Description |
|---|---|---|
id | String | File ID. |
fileSuffix | String | File suffix. |
fileName | String | File name. |
fileType | String | File type. |
size | String | File size. |
updateTime | String | Update time. |
namePath | String | Full name path. |
idPath | String | Full ID path. |
downloadLinks | Array of downLoadLinks objects | Thumbnail link, which is returned for an image. |
containerId | String | Space ID. |
containerType | String | 0: department space 1: individual space |
favorite | Boolean | Whether the file returned by the space is added to favorites by the current user. |
owner | String | Owner name returned for the space. |
attachments | Attachment object | Attachment. |
createTime | String | Creation time. |
editeTime | String | Editing time. |
lastEditor | User object | Last editor. |
mimeType | String | Content type. |
ownerId | String | Owner ID. |
owners | Array of User objects | Owner. |
parentFolder | Array of strings | List of the parent directory IDs. Currently, only the first ID is used. |
properties | Map<String,Object> | Common user-defined attributes of the file. The number of key-value pairs cannot exceed 30. A single key-value pair can contain up to 124 characters. |
recycled | Boolean | Whether the file is moved to the recycle bin. |
sha256 | String | sha256 |
userCapabilities | userCapabilities object | User permissions. |
userProperties | Array of FileListPrivateProperties objects | Extended user attributes. |
Parameter | Type | Description |
|---|---|---|
usage | String | Usage. The value can be thumbnail or content. |
downloadLink | String | Image address. |
Parameter | Type | Description |
|---|---|---|
usage | String | Default usage: content or thumbnail. This parameter is customizable. |
assetId | String | Asset ID |
length | Long | File size. |
versionId | String | Asset version ID. |
mimeType | String | MIME type. |
hash | String | Hash of the resource associated with the asset. |
sha256 | String | SHA256 of the resource associated with the asset. |
createdTime | String | Time when the data is created. |
modifiedTime | String | Time when the data is last modified. |
attributes | Map<String,Object> | Type attributes. |
asset | Asset object | Asset. |
Parameter | Type | Description |
|---|---|---|
id | String | Asset ID |
versionId | String | Asset version ID. |
version | Long | Version number. |
mimeType | String | MIME type |
keepPolicy | Integer | Storage policy of historical versions. |
state | Integer | Data status. |
createdTime | String | Time when the data is created. |
modifiedTime | String | Time when the data is last modified. |
lastModifyingUser | String | UPID of the user that last modifies the data. |
resource | Resource object | Resource. |
cipher | Cipher object | Cipher. |
attributes | Map<String,Object> | Type attributes. A key consists of letters and digits and starts with a letter. A value cannot contain emojis. The size of an attribute is not limited, but the total size cannot exceed 16 KB. Attribute options:
|
properties | Map<String,String> | Extended attributes. |
Parameter | Type | Description |
|---|---|---|
id | String | ID of the file resource. |
hash | String | Hash of the file resource. |
length | Long | Size of the file resource. |
sha256 | String | SHA256 of the file (used for integrity check). |
type | Integer | Resource type. |
state | Integer | Data status. |
sliceSize | Long | Part size. |
hfek | String | Hash of the FEK of the encrypted file. This parameter is applicable when type is set to 0. |
iv | String | IV of the encrypted file. This parameter is applicable when type is set to 0. |
createdTime | String | Time when the data is created. |
modifiedTime | String | Time when the data is last modified. |
objects | Array of SliceObject objects | Part object, which is applicable when type is set to 0 or 3. |
attributes | Map<String,Object> | Type attributes. |
properties | Map<String,String> | Extended attributes. |
Parameter | Type | Description |
|---|---|---|
id | String | Part ID. |
number | Integer | Part No., starting from 0. This parameter is not applicable when type is set to 12. |
start | Long | Start position of a part, which is not applicable when type is set to 12. |
sha256 | String | SHA256 of the part (or SHA256 of the ciphertext if the part is encrypted.) |
length | Long | Part length (or ciphertext length if the part is encrypted). |
bucket | String | OBS bucket information. |
createdTime | String | Time when the data is created. |
modifiedTime | String | Time when the data is last modified. |
uploadUrl | EndpointURL object | Upload URL. |
downloadUrl | EndpointURL object | Download URL. |
uploadId | String | Multipart upload ID. This parameter is applicable when type is set to 12 and uploadMode is set to multipart. |
attributes | Map<String,Object> | Type attributes. |
properties | Map<String,String> | Extended attributes. |
images | Array of Images objects | Thumbnail. |
Parameter | Type | Description |
|---|---|---|
url | String | URL |
method | String | http method |
headers | Map<String,String> | http headers |
forms | Map<String,String> | Form parameter, which is applicable when type is set to 12 and uploadMode is set to post. |
partId | String | Multipart parameter, which is applicable when type is set to 12 and uploadMode is set to multipart. |
Parameter | Type | Description |
|---|---|---|
process | String | File resource name. |
downloadUrl | EndpointURLMetadata object | URL structure for file upload or download. |
Parameter | Type | Description |
|---|---|---|
algorithm | String | Encryption algorithm. |
hfek | String | Hash of the FEK of the encrypted file. This parameter is applicable when type is set to 0 or 4. |
iv | String | IV of the encrypted file. This parameter is applicable when type is set to 0 or 4. |
dataType | Integer | Data type. |
keychains | Array of Keychain objects | Keychain. |
Parameter | Type | Description |
|---|---|---|
id | String | Key UUID. |
type | Integer | Key type. |
algorithm | String | Encryption algorithm. |
ekey | String | Encrypted key. |
Parameter | Type | Description |
|---|---|---|
category | String | Type. The value is drive#user. |
userId | String | Huawei user ID. |
displayName | String | Display name of the user. |
me | Boolean | Whether you are the user. |
permissionId | String | Permission ID. |
Parameter | Type | Description |
|---|---|---|
addChildNodePermission | Boolean | Whether the user can add sub-directories or sub-files. |
copyPermission | Boolean | Whether the user can copy files. |
deletePermission | Boolean | Whether the user can delete files. |
downloadPermission | Boolean | Whether the use can download content. |
editPermission | Boolean | Whether the user can edit files. |
listChildNodePermission | Boolean | Whether the user can list sub-directories or sub-files. |
removeChildNodePermission | Boolean | Whether the user can move sub-directories. |
renameFilePermission | Boolean | Whether the user can rename files. |
shareFilePermission | Boolean | Whether the user can share files. |
uploadPermission | Boolean | Whether the user can upload files. |
viewPermission | Boolean | Whether the user can preview files. |
Example Requests
Example request for searching for a file.
POST /koodrive/ose/v1/files/search
Authorization:Bearer+10f88*********4791e9ff
{
"searchType" : " personal/team",
"pageInfo" : {
"pageSize" : 100,
"pageCursor" : 1
},
"filter" : {
"keyWord" : "Material",
"containerId" : "123456",
"parentFolder" : "1",
"fileType" : "1",
"sizeRang" : "1024,2048",
"updateTimeRange" : "2023-11-02,2023-11-21",
"ownerId" : "Owner ID"
}
} Example Responses
Status code: 200
Search results
{
"files" : [ {
"id" : "Fu2A5BQZ1qUk3h1tU6ZlAS66swzlN9mnJ",
"sha256" : "57eafb818ad716aa11b443fb9fc2c1f23875f0c8da49035a8ca98136e4525632",
"fileName" : "KooDrive Service Overview.docx",
"fileSuffix" : "docx",
"fileType" : "26",
"size" : "705395",
"updateTime" : "2024-12-25T06:41:22.873Z",
"idPath" : "DFcz6PEuDwIArootIAAFWbRXM-jxLg8CA1578177668157825025",
"downloadLinks" : [ {
"usage" : "content",
"downloadLink" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/18ad967c9af047fd8b909ed163c0fdb6086?response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27KooDrive%25E6%259C%258D%25E5%258A%25A1%25E4%25BB%258B%25E7%25BB%258D.docx&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250103T023324Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20250103%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Signature=e518a982307ef9b6d6e4bd8788e421d3488f58f3ed79eb3ab42702ac5c3d7513"
}, {
"usage" : "thumbnail",
"downloadLink" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/18ad967c9af047fd8b909ed163c0fdb6086?x-image-process=image%2Fresize%2Cm_lfit%2Ch_128%2Cw_128&response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27KooDrive%25E6%259C%258D%25E5%258A%25A1%25E4%25BB%258B%25E7%25BB%258D.docx&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250103T023324Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20250103%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Signature=ad55a09e66ddd32c6f9b3cce08c7c9a867c7a579a41200f415fb2918de1ab473"
} ],
"teamName" : "fdsgdsf",
"teamId" : "1578175198769733633",
"containerId" : "IAAFWbRXM-jxLg8CA1578177668157825025",
"containerType" : "0",
"favorite" : false,
"owner" : "hid42638091",
"ownerId" : "1568722386902108288",
"properties" : {
"localCreatedAt" : "",
"localUpdatedAt" : "",
"createUser" : "1568722386902108288",
"lastEditUser" : "1568722386902108288",
"auditResult" : "{\"auditDetail\":\"{}\",\"auditLevel\":10,\"auditResult\":1}"
},
"attachments" : [ {
"assetId" : "1584078561541652992",
"asset" : {
"id" : "1584078561541652992",
"versionId" : "1584078561541652993",
"version" : 49923,
"mimeType" : "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"state" : 0,
"createdTime" : "2024-12-25T06:41:20.050Z",
"modifiedTime" : "2024-12-25T06:41:20.050Z",
"resource" : {
"id" : "1584078561810055808",
"length" : 705395,
"sha256" : "57eafb818ad716aa11b443fb9fc2c1f23875f0c8da49035a8ca98136e4525632",
"object" : {
"id" : "18ad967c9af047fd8b909ed163c0fdb6086",
"start" : 0,
"downloadUrl" : {
"url" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/18ad967c9af047fd8b909ed163c0fdb6086?response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27KooDrive%25E6%259C%258D%25E5%258A%25A1%25E4%25BB%258B%25E7%25BB%258D.docx&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250103T023324Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20250103%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Signature=e518a982307ef9b6d6e4bd8788e421d3488f58f3ed79eb3ab42702ac5c3d7513",
"method" : "GET"
},
"images" : [ {
"process" : "image/resize,m_lfit,h_128,w_128",
"downloadUrl" : {
"url" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/18ad967c9af047fd8b909ed163c0fdb6086?x-image-process=image%2Fresize%2Cm_lfit%2Ch_128%2Cw_128&response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27KooDrive%25E6%259C%258D%25E5%258A%25A1%25E4%25BB%258B%25E7%25BB%258D.docx&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250103T023324Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20250103%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Signature=ad55a09e66ddd32c6f9b3cce08c7c9a867c7a579a41200f415fb2918de1ab473",
"method" : "GET"
}
} ]
}
},
"attributes" : {
"fileName" : "KooDrive Service Overview.docx",
"localCreatedAt" : "",
"createdBy" : "667706171d1c4ef2a4d7464f3656066c",
"resource" : {
"id" : "1584078561810055808",
"object" : {
"bucket" : "b10-obs-ykj-uat-01",
"objectId" : "18ad967c9af047fd8b909ed163c0fdb6086"
}
},
"localUpdatedAt" : ""
}
},
"versionId" : "1584078561541652993",
"attributes" : {
"fileName" : "KooDrive Service Overview.docx",
"localCreatedAt" : "",
"createdBy" : "667706171d1c4ef2a4d7464f3656066c",
"resource" : {
"id" : "1584078561810055808",
"object" : {
"bucket" : "b10-obs-ykj-uat-01",
"objectId" : "18ad967c9af047fd8b909ed163c0fdb6086"
}
},
"localUpdatedAt" : ""
},
"hash" : "57eafb818ad716aa11b443fb9fc2c1f23875f0c8da49035a8ca98136e4525632",
"length" : 705395,
"mimeType" : "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"usage" : "content",
"sha256" : "57eafb818ad716aa11b443fb9fc2c1f23875f0c8da49035a8ca98136e4525632",
"createdTime" : "2024-12-25T06:41:20.050Z",
"modifiedTime" : "2024-12-25T06:41:20.050Z"
} ],
"createdTime" : "2024-12-25T06:41:19.794Z",
"editedTime" : "2024-12-25T06:41:22.873Z",
"lastEditor" : {
"category" : "drive#user",
"me" : true,
"permissionId" : "1570905506917367936",
"userId" : "NDEzMDA4NjAwMDAwMjc0MTY2NS02Njc3MDYxNzFkMWM0ZWYyYTRkNzQ2NGYzNjU2MDY2Yw",
"displayName" : "hid42638091"
},
"mimeType" : "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"owners" : [ {
"category" : "drive#user",
"me" : true,
"permissionId" : "1570905506917367936",
"userId" : "NDEzMDA4NjAwMDAwMjc0MTY2NS02Njc3MDYxNzFkMWM0ZWYyYTRkNzQ2NGYzNjU2MDY2Yw"
} ],
"parentFolder" : [ "DFcz6PEuDwIArootIAAFWbRXM-jxLg8CA1578177668157825025" ],
"recycled" : false,
"userProperties" : {
"properties" : {
"hidden" : "false"
}
},
"userCapabilities" : {
"addChildNodePermission" : true,
"copyPermission" : true,
"deletePermission" : true,
"downloadPermission" : true,
"editPermission" : true,
"listChildNodePermission" : true,
"removeChildNodePermission" : true,
"renameFilePermission" : true,
"shareFilePermission" : true,
"uploadPermission" : true,
"viewPermission" : true
}
} ],
"total" : 1,
"code" : 0,
"msg" : "Successful."
} Status Codes
Status Code | Description |
|---|---|
200 | Search results |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
