1 | |
2 | type Zoho = { |
3 | token: string; |
4 | }; |
5 | |
6 | * Mass delete tags |
7 | * |
8 | */ |
9 | export async function main( |
10 | auth: Zoho, |
11 | body: { |
12 | mass_delete: { |
13 | module: { id: string; api_name: string }; |
14 | tags: { id: string }[]; |
15 | }[]; |
16 | }, |
17 | ) { |
18 | const url = new URL( |
19 | `https://zohoapis.com/crm/v8/settings/tags/actions/mass_delete`, |
20 | ); |
21 |
|
22 | const response = await fetch(url, { |
23 | method: "POST", |
24 | headers: { |
25 | "Content-Type": "application/json", |
26 | Authorization: "Zoho-oauthtoken " + auth.token, |
27 | }, |
28 | body: JSON.stringify(body), |
29 | }); |
30 | if (!response.ok) { |
31 | const text = await response.text(); |
32 | throw new Error(`${response.status} ${text}`); |
33 | } |
34 | return await response.json(); |
35 | } |
36 |
|