0

Reset columns

by
Published Nov 2, 2023

Reset the user's column configuration for the filter to the default. **[Permissions](#permissions) required:** Permission to access Jira, however, columns are only reset for: * filters owned by the user. * filters shared with a group that the user is a member of. * filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for. * filters shared with a public project. * filters shared with the public.

Script jira
  • Submitted by hugo697 Typescript (fetch-only)
    Created 527 days ago
    1
    type Jira = {
    2
      username: string;
    3
      password: string;
    4
      domain: string;
    5
    };
    6
    /**
    7
     * Reset columns
    8
     * Reset the user's column configuration for the filter to the default.
    9
    
    
    10
    **[Permissions](#permissions) required:** Permission to access Jira, however, columns are only reset for:
    11
    
    
    12
     *  filters owned by the user.
    13
     *  filters shared with a group that the user is a member of.
    14
     *  filters shared with a private project that the user has *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for.
    15
     *  filters shared with a public project.
    16
     *  filters shared with the public.
    17
     */
    18
    export async function main(auth: Jira, id: string) {
    19
      const url = new URL(
    20
        `https://${auth.domain}.atlassian.net/rest/api/2/filter/${id}/columns`
    21
      );
    22
    
    
    23
      const response = await fetch(url, {
    24
        method: "DELETE",
    25
        headers: {
    26
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
    27
        },
    28
        body: undefined,
    29
      });
    30
      if (!response.ok) {
    31
        const text = await response.text();
    32
        throw new Error(`${response.status} ${text}`);
    33
      }
    34
      return await response.text();
    35
    }
    36