Edits history of script submission #21459 for ' Get Fields (zoho)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Zoho = {
      token: string;
      baseUrl: string;
    };
    /**
     * Get Fields
     * This API fetches the meta information of all the fields present in a form of a Zoho Creator application.
     */
    export async function main(
      auth: Zoho,
      account_owner_name: string,
      app_link_name: string,
      form_link_name: string,
    ) {
      const url = new URL(
        `${auth.baseUrl}/creator/v2.1/meta/${account_owner_name}/${app_link_name}/form/${form_link_name}/fields`,
      );
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: "Zoho-oauthtoken " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago