Use this operation to search the contents of a folder and its subfolders based on the folder path. The API returns the contents that match a specific search criteria.
Request
Syntax
POST <webservice>/drive/action/search?path={path} HTTP/1.1
Host: <host name>
Accept: application/xml
Authtoken: <authentication token>
Content-type: application/xml
where <webservice> is the root path used to route the API requests to the Web Server.
For more information, see Available Web Services for REST API.
Request Parameters
Name | Description | Required |
path | The path to the folder to be searched. Specify the path relative to the root folder. Note: The path must be URL encoded before they are sent in the request. | Yes |
Request Headers
Name | Description |
Host | The host name of the Web Server or Web Console used in the API request. |
Accept | The format of the response. Valid values are: application/xml or application/json. |
Authtoken | The authentication token received after successfully logging on. For details on receiving an authentication token, see Authentication. |
limit (optional) | The number of results to be listed in a page. Used for changing the paging limits. By default, the limit is 50 results per page. |
offset (optional) | The number from which the results will be displayed. Used for changing the paging offsets. By default, the offset is 0. For example, if limit is 50 and offset is 0, the results are displayed from 1 to 50 (first page). If offset is 50, the results are displayed from 51 to 100 (second page). Similarly, you will add additional offset numbers to display subsequent pages. |
Request Body
You must specify the search criteria by defining filters in the request body . For more information, see Filters.
Response
Response Parameters
Parameter | Description | Element |
path | The path to the file or folder in the search result. The path is displayed relative to the root path. | fileResources |
parentGUID | The GUID of the parent folder of the result item. | fileResources |
parentPath | The path to the parent folder of the result item. The path is displayed relative to the root path. | fileResources |
sizeinBytes | Size of the file in the search result. | fileResources |
downloadUrl | The URL for downloading the file in the search result. By default, a relative download URL is returned. To generate the complete URL of the file, see Generating Full Download URLs. | fileResources |
versionGUID | The unique identifier for a particular version of the file in the search result. If a new version is uploaded a new versionGUID is generated. | fileResources |
name | Name of the file or folder in the search result. | fileResources |
GUID | GUID of the file or folder in the search result. | fileResources |
file | 'file=1' indicates the result item in the search result is a file. | fileResources |
directory | 'directory=1' indicates the result item is a folder. | fileResources |
name | The custom property name assigned to the file or folder in the search result. | nameValues |
value | The value assigned to the custom property. | nameValues |
Examples
Sample Request
POST <webservice>/drive/action/search?path=\docs HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
Content-type: application/xml
<SEARCH_FILTER>
Sample Response
<App_FileResourceListResponse>
<fileResources parentPath="\mystore" GUID="cd23476525334dbd92c26fc8a2f5fbe0" sizeinBytes="11269" downloadUrl="/drive/file/cd23476525334dbd92c26fc8a2f5fbe0/action/download" versionGUID="8dbd2a8f5fc38b8f6291a6b16bc7fd13" path="\mystore\test1.docx" file="1" parentGuid="fc3eebc0d47c4693bea5e4b083ef6477" name="test1.docx">
<customProperties>
<nameValues name="FILE_FOLDER_SORT" value="4\mystore" />
<nameValues name="DATE_ADDED" value="2015-09-01T20:46:53Z" />
<nameValues name="MODIFIED_TIME_ROUND" value="2015-09-01T12:00:00Z" />
<nameValues name="SIZE_KB_ROUND" value="11264" />
<nameValues name="szkbround2" value="11264" />
<nameValues name="IS_VISIBLE" value="true" />
<nameValues name="cvfsuniqueid" value="625287148" />
<nameValues name="timestamp" value="2015-09-01T20:46:53.71Z" />
<nameValues name="mtmstr" value="1441140572" />
<nameValues name="cvurl_4" value="344981367" />
<nameValues name="CVURL" value="344981367" />
<nameValues name="FILE_PATH_DATATYPE" value="4\mystore" />
</customProperties>
</fileResources>
<fileResources parentPath="\mystore" GUID="8639c11531854eff8beac548b9b8cb84" sizeinBytes="12700700" downloadUrl="/drive/file/8639c11531854eff8beac548b9b8cb84/action/download" versionGUID="bc795304afc7e1637701ed1f426911b8" path="\mystore\sample.jpg" file="1" parentGuid="fc3eebc0d47c4693bea5e4b083ef6477" name="sample.jpg">
<customProperties>
<nameValues name="FILE_FOLDER_SORT" value="4\mystore" />
<nameValues name="DATE_ADDED" value="2015-09-01T20:50:01Z" />
<nameValues name="MODIFIED_TIME_ROUND" value="2015-07-30T12:00:00Z" />
<nameValues name="SIZE_KB_ROUND" value="12582912" />
<nameValues name="szkbround2" value="12582912" />
<nameValues name="IS_VISIBLE" value="true" />
<nameValues name="cvfsuniqueid" value="1499837337" />
<nameValues name="timestamp" value="2015-09-01T20:50:01.706Z" />
<nameValues name="mtmstr" value="1438271718" />
<nameValues name="cvurl_4" value="1814249536" />
<nameValues name="CVURL" value="1814249536" />
<nameValues name="FILE_PATH_DATATYPE" value="4\mystore" />
</customProperties>
</fileResources>
</App_FileResourceListResponse>
Supported Error Codes
Code | Status | Description |
---|---|---|
400 | Bad Request | Error caused due to one of the following reasons:
|
404 | Not Found | Path provided in the request is not found. |