//native
type Zoho = {
token: string;
baseUrl: string;
};
/**
* Download File from Subform
* This API downloads a file from a file upload, image, audio, video, or signature field of a specific subform record of a Zoho Creator application.
*/
export async function main(
auth: Zoho,
account_owner_name: string,
app_link_name: string,
report_link_name: string,
record_ID: string,
subform_link_name: string,
field_link_name: string,
subform_record_ID: string,
) {
const url = new URL(
`${auth.baseUrl}/creator/v2.1/data/${account_owner_name}/${app_link_name}/report/${report_link_name}/${record_ID}/${subform_link_name}/${field_link_name}/${subform_record_ID}/download`,
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Zoho-oauthtoken " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 235 days ago