Unable to create a download link for an uploaded Workdrive File
Hello,
I have some custom logic that is working fine to load image files into a Workdrive folder.
I'm not having much success however in being able to then set the file as downloadable and retrieving the download link from my custom logic.
My code for this part is:
- workdriveFile = Map();
- workdriveFile = zoho.workdrive.uploadFile(file_data,workdrive_folder_id,file_name,false,"zoho_workdrive");
- file = workdriveFile.get("data").get(0).get("attributes").get("Permalink");
- info "Workdrive File:";
- info workdriveFile.toString();
- resourceId = file.remove("https://workdrive.zoho.com/file/");
- HeaderMap = Map();
- HeaderMap.put("Accept",mime_type);
- ExternalLinkMap = Map();
- ExternalLinkMap.put("resource_id",resourceId);
- ExternalLinkMap.put("link_name",resourceId);
- ExternalLinkMap.put("request_user_data","false");
- ExternalLinkMap.put("allow_download","true");
- ExternalLinkMap.put("role_id","6");
- AttributesMap = {"attributes":ExternalLinkMap,"type":"links"};
- DataMap = Map();
- DataMap.put("data",AttributesMap);
- info "Parameters:";
- info DataMap.toString();
- CreateExternalLink = Map();
- CreateExternalLink = invokeurl
- [
- url :"https://workdrive.zoho.com/api/v1/links"
- type :POST
- parameters:DataMap.toString()
- connection:"zoho_workdrive"
- ];
- //ShareLink = CreateExternalLink.get("data").get("attributes").get("link");
- info CreateExternalLink.toString();
Below is the result from Flow:
- {
- "info_logs": [
- "Workdrive File:",
- {
- "data": [
- {
- "attributes": {
- "Permalink": "https://workdrive.zoho.com/file/p56860ee52ce9850a4cd79d2fc39357588b48",
- "File INFO": {
- "ORG_ID": "94pew6826015fadde439f805899f17d2ff26e",
- "RESOURCE_ID": "p56860ee52ce9850a4cd79d2fc39357588b48",
- "LIBRARY_ID": "nhi958034f1f94f5f4c3b90e2b588c99b56b8",
- "PARENT_MODEL_ID": "nhi955f40a4daefae4f3fbd18e362fd7ecf86",
- "PARENT_ID": "nhi955f40a4daefae4f3fbd18e362fd7ecf86",
- "RESOURCE_TYPE": 2501,
- "WMS_SENT_TIME": 1632390988265,
- "TAB_ID": -1,
- "OWNER": 673649126,
- "RESOURCE_GROUP": "FILE",
- "PARENT_MODEL_NAME": "file",
- "size": 68242,
- "OPERATION": "UPLOAD",
- "EVENT_ID": -1,
- "AUDIT_INFO": {
- "resource": {
- "owner": 673649126,
- "created_time": 1632390988204,
- "creator": 653631583,
- "service_type": 4,
- "extension": "jpeg",
- "resource_type": 2501,
- "name": "123_1 (19).jpeg"
- },
- "parentInfo": {
- "parentName": "MMS",
- "parentId": "nhi955f40a4daefae4f3fbd18e362fd7ecf86",
- "parentType": 1001
- },
- "libraryInfo": {
- "libraryName": "Cliq",
- "libraryId": "nhi958034f1f94f5f4c3b90e2b588c99b56b8",
- "libraryType": 14
- },
- "statusCode": "D201"
- },
- "ZUID": 653631583,
- "TEAM_ID": "94pew6826015fadde439f805899f17d2ff26e"
- },
- "parent_id": "nhi955f40a4daefae4f3fbd18e362fd7ecf86",
- "FileName": "123_1 (19).jpeg",
- "resource_id": "p56860ee52ce9850a4cd79d2fc39357588b48"
- },
- "type": "files"
- }
- ]
- },
- "Parameters:",
- {
- "data": {
- "attributes": {
- "resource_id": "p56860ee52ce9850a4cd79d2fc39357588b48",
- "link_name": "p56860ee52ce9850a4cd79d2fc39357588b48",
- "request_user_data": false,
- "allow_download": true,
- "role_id": 6
- },
- "type": "links"
- }
- },
- ""
- ],
- "extractMMS_19": ""
- }
The info sections are arranged in three blocks. The first block at line 3 is the result from the initial file upload, which is working fine.
The second block at line 57 is the parameters as they've been defined for creating the shareable link. The response at line 70 is null.
Is there something i'm not setting up correctly?
Thanks,
Bryan
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.