Edits history of script submission #21275 for ' Delete Record by ID (zoho)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Zoho = {
      token: string;
      baseUrl: string;
    };
    /**
     * Delete Record by ID
     * This API deletes a specific record, identified by its ID value, which is displayed in a report of your Zoho Creator application. The delete request is subject to custom validations configured for the target form.
     */
    export async function main(
      auth: Zoho,
      account_owner_name: string,
      app_link_name: string,
      report_link_name: string,
      record_ID: string,
      body: {
        result?: { message?: false | true; tasks?: false | true };
        skip_workflow?: {}[];
      },
    ) {
      const url = new URL(
        `${auth.baseUrl}/creator/v2.1/data/${account_owner_name}/${app_link_name}/report/${report_link_name}/${record_ID}`,
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Zoho-oauthtoken " + auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago