//native
type Zoho = {
token: string;
};
/**
* Schedule
*
*/
export async function main(
auth: Zoho,
body: {
backup: {
rrule: string;
id: string;
start_date: string;
scheduled_date: string;
status: string;
requester: { id: string; name: string; zuid: string };
};
},
) {
const url = new URL(`https://zohoapis.com/crm/bulk/v8/backup`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Zoho-oauthtoken " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago