Edits history of script submission #20517 for ' List Image URLs (smartsheet)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Smartsheet = {
      token: string;
      baseUrl: string;
    };
    /**
     * List Image URLs
     * Posts an array of Image Url objects that can be used to retrieve the specified cell images.
     */
    export async function main(
      auth: Smartsheet,
      body: {
        imageId?: string;
        error?: { refId?: string; errorCode?: number; message?: string };
        height?: number;
        url?: string;
        width?: number;
      }[],
    ) {
      const url = new URL(`${auth.baseUrl}/imageurls`);
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago