0

Get issue link type

Published Nov 2, 2023

Returns an issue link type. To use this operation, the site must have [issue linking](https://confluence.atlassian.com/x/yoXKM) enabled. This operation can be accessed anonymously. **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for a project in the site.

Script jira
  • Submitted by hugo697 Typescript (fetch-only)
    Created 565 days ago
    1
    type Jira = {
    2
      username: string;
    3
      password: string;
    4
      domain: string;
    5
    };
    6
    /**
    7
     * Get issue link type
    8
     * Returns an issue link type.
    9
    
    
    10
    To use this operation, the site must have [issue linking](https://confluence.atlassian.com/x/yoXKM) enabled.
    11
    
    
    12
    This operation can be accessed anonymously.
    13
    
    
    14
    **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for a project in the site.
    15
     */
    16
    export async function main(auth: Jira, issueLinkTypeId: string) {
    17
      const url = new URL(
    18
        `https://${auth.domain}.atlassian.net/rest/api/2/issueLinkType/${issueLinkTypeId}`
    19
      );
    20
    
    
    21
      const response = await fetch(url, {
    22
        method: "GET",
    23
        headers: {
    24
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
    25
        },
    26
        body: undefined,
    27
      });
    28
      if (!response.ok) {
    29
        const text = await response.text();
    30
        throw new Error(`${response.status} ${text}`);
    31
      }
    32
      return await response.json();
    33
    }
    34