Search¶
Search for folder and files on a specified node with a given keyword. Optionally within a given folder.
Request¶
POST https://test-uni.cloudplan.biz/api/search/search
{
"keyword": ... the keyword to search for
"folder_id": ... (optional) only include content within this folder and its subfolders
"admin": true/false (optional) search whole organisation as administrators
"number": 10 (optional) number of hits to return
"sort_modified": "asc"/"desc" (optional) sort by modified time
"modified": {...} (optional) filter modified times
e.g. {"gt": 1559659091} -> files modified after 1559659091
{"gt": 1559659091, "lt": 1569657672} -> files modified between 1559659091 and 1569657672
{"lt": 1569657672} -> files modified before 1569657672
possible operators are: "gt", "lt", "gte", "lte"
"changed_by_user_id": ... (optional) filter by changed user id
"org_id": ... (optional, only for cloudplan internal use) filter by organisation id
"tags": [] (optional) filter for certain tags
e.g. {"tag_id": "56XYZ..."}
{"tag_id": "56ZYXVW.", "val_int":{"gt": 10, "lt":42}}
}
Tag Filtering Examples¶
Here are some examples for more extensive tag filtering.
- Match any file with tag id _574C6B6508BEE85844A0D61E5A3F141D_
{
"keyword": "",
"tags": [
{"tag_id": "574C6B6508BEE85844A0D61E5A3F141D"}
]
}
- If tag with id _5751A9B542E02006F3FA48C65973D5BB_ is of _type ‘int_val’_ it can have integer values assigned to it. This query will search for any file with this tag and its value between 10 and 42.
Note the similarity to the ‘modified’ operators.
{
"keyword": "",
"tags": [
{"tag_id": "5751A9B542E02006F3FA48C65973D5BB",
"val_int": {"gt": 10 "lt":42}}
]
}
- Multiple tags can be matched too. This will match files which contain both tags.
{
"keyword": "",
"tags": [
{"tag_id": "574C6B6508BEE85844A0D61E5A3F141D"}
{"tag_id": "5751A9B542E02006F3FA48C65973D5BB",
"val_int": {"gt": 10, "lt":42}}
]
}
- A key-value type tag can also be searched for without a specified value.
{
"keyword": "",
"tags": [
{"tag_id": "5751A9B542E02006F3FA48C65973D5BB"}
]
}
Reply¶
{
"result": true/false
"total_hits": 0 number of total hits in the search
"index_size_bytes": 0 size of the searched index
"took_ms": 0 time it took to execute this search
"index_count": 0 total number of files in the searched index
"find_results": [
"cp_id": ...
"name": ...
"type": "file"/"folder"
"changed_by": ...
"create": ...
"modified": ...
"pfid": .... parent folder id
"size": ... files only - exact size of files in bytes (only correct for files < 4gb)
]
}
Error Codes¶
folder_id_empty
folder_not_found
user_has_no_access
node_error