0

Publish API Add Records

by
Published Oct 17, 2025

This API adds one or more records to a form in your Zoho Creator application. Subject to validations, each JSON object in the input file will be added as a record. A maximum of 200 records can be created per request.

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
 * Publish API Add Records
8
 * This API adds one or more records to a form in your Zoho Creator application. Subject to validations, each JSON object in the input file will be added as a record. A maximum of 200 records can be created per request.
9
 */
10
export async function main(
11
  auth: Zoho,
12
  account_owner_name: string,
13
  app_link_name: string,
14
  form_link_name: string,
15
  privatelink: string | undefined,
16
  body: {
17
    result?: {
18
      fields?: string[];
19
      message?: false | true;
20
      tasks?: false | true;
21
    };
22
    data?: {}[];
23
  },
24
) {
25
  const url = new URL(
26
    `${auth.baseUrl}/creator/v2.1/publish/${account_owner_name}/${app_link_name}/form/${form_link_name}`,
27
  );
28
  for (const [k, v] of [["privatelink", privatelink]]) {
29
    if (v !== undefined && v !== "" && k !== undefined) {
30
      url.searchParams.append(k, v);
31
    }
32
  }
33
  const response = await fetch(url, {
34
    method: "POST",
35
    headers: {
36
      "Content-Type": "application/json",
37
      Authorization: "Zoho-oauthtoken " + auth.token,
38
    },
39
    body: JSON.stringify(body),
40
  });
41
  if (!response.ok) {
42
    const text = await response.text();
43
    throw new Error(`${response.status} ${text}`);
44
  }
45
  return await response.json();
46
}
47