0

Update a project

by
Published Oct 17, 2025

Update details of a project.

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 a project
7
 * Update details of a project.
8
 */
9
export async function main(
10
  auth: Zoho,
11
  project_id: string,
12
  X_com_zoho_subscriptions_organizationid: string,
13
  body: {
14
    project_name: string;
15
    customer_id: string;
16
    description?: string;
17
    billing_type: string;
18
    rate?: string;
19
    budget_type?: string;
20
    budget_hours?: string;
21
    budget_amount?: string;
22
    tasks?: {
23
      task_name: string;
24
      description?: string;
25
      rate?: string;
26
      budget_hours?: string;
27
    }[];
28
    users?: {
29
      user_id?: string;
30
      is_current_user?: false | true;
31
      user_name?: string;
32
      email?: string;
33
      user_role?: string;
34
      status?: string;
35
      rate?: string;
36
      budget_hours?: string;
37
      total_hours?: string;
38
      billed_hours?: string;
39
      un_billed_hours?: string;
40
    }[];
41
  },
42
) {
43
  const url = new URL(
44
    `https://www.zohoapis.com/billing/v1/projects/${project_id}`,
45
  );
46

47
  const response = await fetch(url, {
48
    method: "PUT",
49
    headers: {
50
      "X-com-zoho-subscriptions-organizationid":
51
        X_com_zoho_subscriptions_organizationid,
52
      "Content-Type": "application/json",
53
      Authorization: "Zoho-oauthtoken " + auth.token,
54
    },
55
    body: JSON.stringify(body),
56
  });
57
  if (!response.ok) {
58
    const text = await response.text();
59
    throw new Error(`${response.status} ${text}`);
60
  }
61
  return await response.json();
62
}
63