0

Get profile

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
 * Get profile
7
 *
8
 */
9
export async function main(
10
  auth: Zoho,
11
  id: string,
12
  X_ZCSRF_TOKEN?: string,
13
  X_ZOHO_SERVICE?: string,
14
) {
15
  const url = new URL(`https://zohoapis.com/crm/v8/settings/profiles/${id}`);
16

17
  const response = await fetch(url, {
18
    method: "GET",
19
    headers: {
20
      ...(X_ZCSRF_TOKEN ? { "X-ZCSRF-TOKEN": X_ZCSRF_TOKEN } : {}),
21
      ...(X_ZOHO_SERVICE ? { "X-ZOHO-SERVICE": X_ZOHO_SERVICE } : {}),
22
      Authorization: "Zoho-oauthtoken " + auth.token,
23
    },
24
    body: undefined,
25
  });
26
  if (!response.ok) {
27
    const text = await response.text();
28
    throw new Error(`${response.status} ${text}`);
29
  }
30
  return await response.json();
31
}
32