Edits history of script submission #11242 for ' Delete commerce integration (pinterest)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Pinterest = {
      token: string;
    };
    /**
     * Delete commerce integration
     * Delete commerce integration metadata for the given external business ID.
    Note: If you're interested in joining the beta, please reach out to your Pinterest account manager.
     */
    export async function main(auth: Pinterest, external_business_id: string) {
      const url = new URL(
        `https://api.pinterest.com/v5/integrations/commerce/${external_business_id}`,
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + 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 536 days ago