0

Update comment

by
Published Oct 17, 2025

Update an existing comment of a quote.

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 comment
7
 * Update an existing comment of a quote.
8
 */
9
export async function main(
10
  auth: Zoho,
11
  estimate_id: string,
12
  comment_id: string,
13
  X_com_zoho_subscriptions_organizationid: string,
14
  body: { description?: string; show_comment_to_clients?: false | true },
15
) {
16
  const url = new URL(
17
    `https://www.zohoapis.com/billing/v1/estimates/${estimate_id}/comments/${comment_id}`,
18
  );
19

20
  const response = await fetch(url, {
21
    method: "PUT",
22
    headers: {
23
      "X-com-zoho-subscriptions-organizationid":
24
        X_com_zoho_subscriptions_organizationid,
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