Delete issue property

Deletes an issue's property. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* and *Edit issues* [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project containing the issue. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.

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
 * Delete issue property
8
 * Deletes an issue's property.
9

10
This operation can be accessed anonymously.
11

12
**[Permissions](#permissions) required:**
13

14
 *  *Browse projects* and *Edit issues* [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project containing the issue.
15
 *  If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
16
 */
17
export async function main(
18
  auth: Jira,
19
  issueIdOrKey: string,
20
  propertyKey: string
21
) {
22
  const url = new URL(
23
    `https://${auth.domain}.atlassian.net/rest/api/2/issue/${issueIdOrKey}/properties/${propertyKey}`
24
  );
25

26
  const response = await fetch(url, {
27
    method: "DELETE",
28
    headers: {
29
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
30
    },
31
    body: undefined,
32
  });
33
  if (!response.ok) {
34
    const text = await response.text();
35
    throw new Error(`${response.status} ${text}`);
36
  }
37
  return await response.text();
38
}
39