Upload File In Zoho WorkDrive
Table of Contents
Description
The zoho.workdrive.uploadFile task uploads a file to the specified folder in Zoho WorkDrive.
Syntax
<response> = zoho.workdrive.uploadFile(<file>, <folder_id>, <file_name>, <override_name_exist>, <connection>);
where:
Params | Data type | Description |
<response> | KEY-VALUE | The details of the file that will be uploaded to the specified folder of Zoho WorkDrive. |
<file> | FILE | The file that will be uploaded. Note:
|
<folder_id> | TEXT | The ID of the folder to which the file will be uploaded. Note: You can get the folder_id parameter from the Zoho WorkDrive URL. The URL will be in the following format: https://workdrive.zoho.com/home/teams/<team_id>/privatespace/folders/<folder_id> |
<file_name> | TEXT | The name of the file should be URL encoded with UTF-8 Charset. |
<override_name_exist> | BOOLEAN | This parameter decides what will happen if a file with the same name already exists in the specified folder. Allowed values:
|
<connection> | TEXT | The link name of the connection. Note:
|
Example
Example 1
The following script uploads an encoded file to the specified folder in Zoho WorkDrive:
myurl = encodeUrl("book1.pdf"); sample_file = invokeUrl [ url: "http://www.africau.edu/images/default/sample.pdf" type: GET ]; response = zoho.workdrive.uploadFile(sample_file, "g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXXb0d05", myurl , false, "workdrive_connection");
where:
response
sample_file
"g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXXb0d05"
myurl
false
"workdrive_oauth_connection"
The TEXT that represents the connection link name.
Response Format
Success Response
The success response will be returned in the following format:
{
"data": [
{
"attributes": {
"File INFO": "{\"RESOURCE_ID\":\"g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXX100c5\",\"LIBRARY_ID\":\"3uinyXXXXXXXXXXXXXXXXXXXXXXXXXXX428fd\",\"PARENT_MODEL_ID\":\"g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXXb0d05\",\"PARENT_ID\":\"g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXXb0d05\",\"RESOURCE_TYPE\":2001,\"WMS_SENT_TIME\":\"1566479972918\",\"OWNER\":\"667XXX621\",\"RESOURCE_GROUP\":\"FILE\",\"PARENT_MODEL_NAME\":\"file\",\"OPERATION\":\"UPLOAD\",\"EVENT_ID\":\"-1\",\"AUDIT_INFO\":{\"resource\":{\"owner\":\"667XXX621\",\"created_time\":1566479972495,\"creator\":\"662607120\",\"service_type\":1,\"extension\":\"txt\",\"resource_type\":2001,\"name\":\"sample.txt\"},\"parentInfo\":{\"parentName\":\"Folder 1\",\"parentId\":\"g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXXb0d05\",\"parentType\":1001},\"libraryInfo\":{\"libraryName\":\"MYSPACE_LIBRARY\",\"libraryId\":\"3uinyXXXXXXXXXXXXXXXXXXXXXXXXXXX428fd\",\"libraryType\":20},\"statusCode\":\"D201\"},\"ZUID\":662607120,\"TEAM_ID\":\"6oq3dXXXXXXXXXXXXXXXXXXXXXXXXXXX4a777\"}",
"parent_id": "g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXXb0d05",
"FileName": "sample.txt",
"resource_id": "g4xh1XXXXXXXXXXXXXXXXXXXXXXXXXXX100c5"
},
"type": "files"
}
]
}
Failure Response
The failure response for an incorrect folder ID will be returned in the following format:
{
"errors": [
{
"id": "F6003",
"title": "Invalid Param found"
}
]
}