Get issue security level

Returns details of an issue security level. Use [Get issue security scheme](#api-rest-api-2-issuesecurityschemes-id-get) to obtain the IDs of issue security levels associated with the issue security scheme. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None.

Script jira Verified

by hugo697 ยท 11/2/2023

The script

Submitted by hugo697 Typescript (fetch-only)
Verified 396 days ago
1
type Jira = {
2
  username: string;
3
  password: string;
4
  domain: string;
5
};
6
/**
7
 * Get issue security level
8
 * Returns details of an issue security level.
9

10
Use [Get issue security scheme](#api-rest-api-2-issuesecurityschemes-id-get) to obtain the IDs of issue security levels associated with the issue security scheme.
11

12
This operation can be accessed anonymously.
13

14
**[Permissions](#permissions) required:** None.
15
 */
16
export async function main(auth: Jira, id: string) {
17
  const url = new URL(
18
    `https://${auth.domain}.atlassian.net/rest/api/2/securitylevel/${id}`
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