Edits history of script submission #17375 for ' Get total app metrics (miro)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Miro = {
      token: string;
    };
    /**
     * Get total app metrics
     * Returns total usage metrics for a specific app since the app was created.
    
    This endpoint requires an app management API token. It can be generated in your apps section of Developer Hub.
    Required scope boards:read
    Rate limiting Level 1
    
     */
    export async function main(auth: Miro, app_id: string) {
      const url = new URL(
        `https://api.miro.com//v2-experimental/apps/${app_id}/metrics-total`,
      );
    
      const response = await fetch(url, {
        method: "GET",
        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 235 days ago