0

Get fixed asset list

by
Published Oct 17, 2025

fixed asset list.

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 fixed asset list
7
 * fixed asset list.
8
 */
9
export async function main(
10
  auth: Zoho,
11
  organization_id: string | undefined,
12
  filter_by: string | undefined,
13
  sort_column: string | undefined,
14
  sort_order: string | undefined,
15
) {
16
  const url = new URL(`https://www.zohoapis.com/books/v3/fixedassets`);
17
  for (const [k, v] of [
18
    ["organization_id", organization_id],
19
    ["filter_by", filter_by],
20
    ["sort_column", sort_column],
21
    ["sort_order", sort_order],
22
  ]) {
23
    if (v !== undefined && v !== "" && k !== undefined) {
24
      url.searchParams.append(k, v);
25
    }
26
  }
27
  const response = await fetch(url, {
28
    method: "GET",
29
    headers: {
30
      Authorization: "Zoho-oauthtoken " + auth.token,
31
    },
32
    body: undefined,
33
  });
34
  if (!response.ok) {
35
    const text = await response.text();
36
    throw new Error(`${response.status} ${text}`);
37
  }
38
  return await response.json();
39
}
40