Search by folder name
Overviewβ
There is no restriction on having two different folders with the same name. As such, if you are dynamically creating folders in your application, you need to be able to check whether the folder already exist or not. This API lets you search with the name of a folder and return the id and path of the matching folder.
Request structureβ
POST https://dev.vdocipher.com/api/videos/folders/search
content-type: application/json
authorization: Apisecret _______
{
"name": "search query"
}
Input parametersβ
Name | attribute | description |
---|---|---|
name | string (required) | the search query upto 255 characters |
searchExact | boolean (optional) (default false) | If false, it will search all folders starting with this text. If true, will only return exact matched folders. |
Responseβ
{
"folders": [
{
"name": "search query and more text",
"id": "abcdef1234567890abcdef1234567890",
"folderPath": [
{
"id": "c84a81f7976441d395ac3a3fc135a5fe",
"name": "samples"
}
],
"createdAt": "2019-10-27T04:19:19.000Z"
}
]
}
Understanding the folder pathβ
The folder path is an array denoting the path to a folder. It contains an array of object with each object containing id
and name
.
For a folder at the top-level, this will be an empty array []
.
For a folder which is located three or more levels deep. The folder is in reverse order of path. That means that if the structure is like below:
[
{
"id": "c84a81f7976441d395ac3a3fc135a5fe",
"name": "samples"
},
{
"id": "c84a81f7976441d395ac3a3fc135a5fe",
"name": "folder-sample"
}
]
Then the path of this folder is
/folder-sample/samples/
Sample Codeβ
The folder search query is written as __query__
. The sample API Secret Key is a1b2c3d4e5
.
- CURL
- NODE
curl -X POST "https://dev.vdocipher.com/api/videos/folders/search" \
-H 'content-type: application/json' \
-H 'Authorization: Apisecret a1b2c3d4e5' \
-d "{\"name\": \"__query__\"}"
var request = require('request');
var options = {
method: 'POST',
url: 'https://dev.vdocipher.com/api/videos/folders/search',
headers: {
Authorization: 'Apisecret a1b2c3d4e5',
},
body: {
name: '__query__',
},
json: true,
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});