DirectCloud API-5.508.1230
Table of Contents
1. parameter setting
Basic Settings
Operation : Folder operation system
Folder operation system
Get Folder List: Obtains a list of folders without a folder specified by a node.
Get Folder Info: Obtains folder information specified by node/folder identification code.
Create Folder: Creates a new folder in the folder specified by the node.
Rename Folder: Renames a folder specified by a node.
Delete Folder: Deletes the folder specified by the node.
Move Folder: Moves a node-specified folder to a node-specified folder.
Get Folder Quotation: Obtains the maximum storage capacity (quota) and the amount of space in use for the folder specified by the node.
File Operation System
Get File List: Obtains a list of files in the folder specified by the node.
Get File Info: Obtains information on the file specified by the file identification code.
Upload File: Uploads a file to the specified folder in the node.
Rename File: Renames a file specified by file identification code.
Download File: Downloads the file specified by the file identification code.
Delete File: Deletes the file specified by the file identification code.
Move File: Moves the file specified by the file identification code to the folder specified by the node.
Search File: Searches for files in the folder specified by the node using keywords (exact match search).
Token : Searches for a file in the folder specified by the node.
service : service of API key
service_key: service_key of API key
Company ID : company ID
User ID: user ID
Password : password
Company ID, User ID, and Password are the same as those used for login.
Extended Settings (Advanced)
Folder Node :
Enter the node of the folder.
The node can be viewed by an account with administrative privileges.
Folder Op : Enter the folder op code (dir_seq).
Folder Seq Code : Enter the folder identification code (dir_seq).
Folder Name : Enter the folder name when the folder is created or changed. If the same folder already exists in the folder, an error will occur.
Move Nodes: Enter node information when moving a folder. The input method is as follows.
{target node}|{destination node}
{target node}: Node of the folder to be moved
{destination node}: Node of the destination folder, which will be moved into this folder
Enter each node with a "|" (vertical line) between them.
File Op : Enter the keywords for the file search.
Search Keyword: Enter keywords for file search.
Files Sort: Specify how to sort the list of files in the search results. Select the sorting method from the following. Default is set to +name.
+name: Sort in ascending order by file name
-name: Sort in descending order by file name
+datetime: Sort by file date in ascending order
-datetime: Sort by file date in descending order
+size: Sort in ascending order by file size
-size: Sort in descending order by file size
File Num limit: Enter the number of files to search at one time. The maximum value is 1000. If the value is greater than this, an error will occur. The default value is 100.
File Offset: Enter the number of files that exist after page 2. Default is set to 0.
File Seq Code: Enter the file identification code (file_seq).
File Path: Enter the file path of the file to be uploaded, or select a file.
File Name: Enter the name of the file to be changed, including the file extension. If the same file already exists in the folder, an error will occur.
Save File Path: Enter the file path where the file to be downloaded will be saved. Enter the full path including the file extension.
If the file extension of the file to be downloaded is different from the file extension of the entered file path, the file may be corrupted, file extension of the file to be downloaded and the file extension of the file path entered, the file may be corrupted.
Download Direct: Select whether or not to download the file directly.
Yes: The file will be downloaded directly. The file will be saved to the file path entered in Save File Path.
No: The file will not be downloaded directly.
The URL for download is issued in the return value JSON. The URL can be obtained by obtaining "download_url" in the JSON. The download URL can be used for one minute only.
Move File IDs: Enter node information when moving files.
The input method is as follows
{file_seq}|{node}
{file_seq}: Identification code of the file to be moved
{node}: Node of the destination folder, to be moved within this folder
Enter each code node with a "|" (vertical line) between them.
Language : Enter the language in the "Language" field.
Select the language for JSON responses.
jpn : Japanese
kor: Korean
eng: English
Error and other messages are displayed in the selected language.
2. Return Value
Result Type 1.
String : JSON
CSV: JSON
File : JSON
3. Example
1. uploading files to a specific folder
File Path: C:\Users\Windows\Documents\test.txt
Execution Result
Return Value:
File Path: C:\Users\Windows\Documents\return.json
{
"success": true,
"file_seq": 0101010,
"name": "test.txt",
"extension": "txt",
"size": 8640,
"sizetext": "3.35KB"
}
2. search for a specific folder and retrieve a node (composite Op)
Using Get Folder List, consider a scenario where the name is a partial match.
See the following image.
use DirectCloud API plugin to get the folder list.
Save the returned JSON to a file named retrun.json.
Return Value:
File Path: C:\Users\Windows\Documents\retrun.json
[
{
"dir_seq": 83002,
"parent_node": "1{1",
"node": "1{1011",
"name": "Photo",
"type": "shared",
"datetime": "2019-12-19 16:29:45"
},
{
"dir_seq": 83003,
"parent_node": "1{1",
"node": "1{1012",
"name": "Video",
"type": "shared",
"datetime": "2018-05-29 14:01:07"
},
{
"dir_seq": 110334,
"parent_node": "1{1",
"node": "1{1013",
"name": "Contract",
"type": "shared",
"datetime": "2020-06-12 16:56:47"
}
]
This is not processed by the JSON Select plugin, so it must be modified so that it can be processed.
Write {'data' at the beginning of the file in the Text Write plugin.
Write } at the end of the file with the Text Write plugin.
Replace all ''s with " in String Manipulation plugin.
Now you can read the file with the JSON Select plugin.
{ "data".
[
{
"dir_seq": 83002,.
"type": "shared", "node".
"datetime": "2019-12-19 16:29:45"
},
{
"dir_seq": 83003, }
"parent_node": "1{1", { "parent_node".
"node": "1{1012", "node".
"type": "shared", "node".
"datetime": "2018-05-29 14:01:07"
},
{
"dir_seq": 110334, {
"parent_node": "1{1", { "node".
"node": "1{1013", "node".
"name": "Contract", "type": "shared", "shared".
"datetime": "2020-06-12 16:56:47"
}
]
}
- Count the number of folders using the Get Length option of the JSON Select plugin. This will match the number of elements in the "data" list to the number of folders.
Stored in {{Folder.Count}} of User Variables. - exception handling when the number of elements in "data" is 0, i.e., the folder is not found. ({{Folder.Count}}! =0)
- process within each element using Repeat. Use Index to increment the value of {{rp.index}} from 0 to 1. This is so that elements in the list are acquired in order, e.g. data[0], data[1].......
- The "name" of each element is retrieved. The element is retrieved as data[{{rp.index}}]/name.
- Check if the retrieved name ({{Folder.Name}}) contains the word you want to search. This is done by String Manipulation.
Here we are looking for a folder that contains the word "Test". The search is performed and the hits are stored in {{Hit.Count}}. - Check if the word you want to search for is included in the folder name. If it is included, {{Hit.Count}} is set to 1, and the folder node is retrieved as it is.
- retrieve the folder node. The "node" of each element is acquired. The element is acquired as data[{{rp.index}}]/node.
Once the node is retrieved, we use JumpToOperation to move it to the End of Step/Func. This can be used for file retrieval as well. Since the DirectCloud API only allows exact match searches, this method must be used for partial match searches, etc.
These scenarios are also equally useful when a JSON array is returned directly from the API