How to Download a File from Zoho WorkDrive Using a Public Link
How to Download a File from Zoho WorkDrive Using a Public Link
If you're working with Zoho WorkDrive and want to download a file using a public link, here's a simple method to do so using API or a basic script. This approach helps developers or teams quickly fetch shared resources without logging in or authenticating each time.
In this example, you’ll just need the Zoho WorkDrive public file link ID, and you can use the following code snippet to trigger the download.
Make sure to replace the placeholder ID with your actual Zoho WorkDrive public file ID.
- header = Map();
-
header.put("Accept","application/vnd.api+json");
-
data = Map();
-
data_param1 = Map();
-
att_param1 = Map();
-
att_param1.put("resource_id","7dxim0d37f62283e042b8951bbfe3eae84d74");
-
att_param1.put("link_name","report2021");
-
att_param1.put("link_type","download");
-
att_param1.put("request_user_data","false");
-
att_param1.put("allow_download","true");
-
innerattr_param_map1 = Map();
-
data_param1.put("attributes",att_param1);
-
data_param1.put("type","links");
-
data.put("data",data_param1);
-
response = invokeurl
-
[
-
url :"
-
type :POST
-
parameters:data.toString()
-
headers:header
-
connection:"zohoworkdrive"
-
];
-
download_url = response.get("data").getJSON("attributes").getJSON("download_url");
-
download_url = download_url + "?directDownload=true";
-
openUrl(download_url,"new window");
Replace 7dxim0d37f62283e042b8951bbfe3eae84d74 with your Zoho WorkDrive ID.