0

Update portal

by
Published Oct 17, 2025
Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
};
5
/**
6
 * Update portal
7
 *
8
 */
9
export async function main(
10
  auth: Zoho,
11
  portal_name: string,
12
  body: {
13
    portals: {
14
      created_time: string;
15
      modified_time: string;
16
      modified_by: { name: string; id: string };
17
      created_by: { name: string; id: string };
18
      zaid: string;
19
      name: string;
20
      active: false | true;
21
    }[];
22
  },
23
) {
24
  const url = new URL(
25
    `https://zohoapis.com/crm/v8/settings/portals/${portal_name}`,
26
  );
27

28
  const response = await fetch(url, {
29
    method: "PUT",
30
    headers: {
31
      "Content-Type": "application/json",
32
      Authorization: "Zoho-oauthtoken " + auth.token,
33
    },
34
    body: JSON.stringify(body),
35
  });
36
  if (!response.ok) {
37
    const text = await response.text();
38
    throw new Error(`${response.status} ${text}`);
39
  }
40
  return await response.json();
41
}
42