0

Delete dashboard

by
Published Nov 2, 2023

Deletes a dashboard. **[Permissions](#permissions) required:** None The dashboard to be deleted must be owned by the user.

Script jira
  • Submitted by hugo697 Typescript (fetch-only)
    Created 525 days ago
    1
    type Jira = {
    2
      username: string;
    3
      password: string;
    4
      domain: string;
    5
    };
    6
    /**
    7
     * Delete dashboard
    8
     * Deletes a dashboard.
    9
    
    
    10
    **[Permissions](#permissions) required:** None
    11
    
    
    12
    The dashboard to be deleted must be owned by the user.
    13
     */
    14
    export async function main(auth: Jira, id: string) {
    15
      const url = new URL(
    16
        `https://${auth.domain}.atlassian.net/rest/api/2/dashboard/${id}`
    17
      );
    18
    
    
    19
      const response = await fetch(url, {
    20
        method: "DELETE",
    21
        headers: {
    22
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
    23
        },
    24
        body: undefined,
    25
      });
    26
      if (!response.ok) {
    27
        const text = await response.text();
    28
        throw new Error(`${response.status} ${text}`);
    29
      }
    30
      return await response.text();
    31
    }
    32