//native
type Zoho = {
token: string;
};
/**
* Get attachment
*
*/
export async function main(
auth: Zoho,
_module: string,
record_id: string,
id: string,
) {
const url = new URL(
`https://zohoapis.com/crm/v8/${_module}/${record_id}/Attachments/${id}`,
);
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