Edits history of script submission #14441 for ' Get web link (box)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Box = {
      token: string;
    };
    /**
     * Get web link
     * Retrieve information about a web link.
     */
    export async function main(auth: Box, web_link_id: string, boxapi: string) {
      const url = new URL(`https://api.box.com/2.0/web_links/${web_link_id}`);
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          boxapi: boxapi,
          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