Edits history of script submission #21902 for ' Retrieve a hosted page (zoho)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Zoho = {
      token: string;
    };
    /**
     * Retrieve a hosted page
     * Details of a specific hosted page. The data field will be populated with the subscription details in case of successfull subscription via Hostedpage. In case of fresh hosted pages the data field will be empty.
     */
    export async function main(
      auth: Zoho,
      hostedpage_id: string,
      X_com_zoho_subscriptions_organizationid: string,
    ) {
      const url = new URL(
        `https://www.zohoapis.com/billing/v1/hostedpages/${hostedpage_id}`,
      );
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          "X-com-zoho-subscriptions-organizationid":
            X_com_zoho_subscriptions_organizationid,
          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