0

Create Bulk Read job

by
Published Oct 17, 2025

To create a bulk read job to export records.

Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
  baseUrl: string;
5
};
6
/**
7
 * Create Bulk Read job
8
 * To create a bulk read job to export records.
9
 */
10
export async function main(
11
  auth: Zoho,
12
  account_owner_name: string,
13
  app_link_name: string,
14
  report_link_name: string,
15
  body: {
16
    query?: { criteria?: string; max_records?: number; fields?: string[] };
17
  },
18
) {
19
  const url = new URL(
20
    `${auth.baseUrl}/creator/v2.1/bulk/${account_owner_name}/${app_link_name}/report/${report_link_name}/read`,
21
  );
22

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