Delete app property
One script reply has been approved by the moderators Verified

Deletes an app's property.

Permissions required: Only a Connect app whose key matches addonKey can make this request. Additionally, Forge apps can access Connect app properties (stored against the same app.connect.key).

Created by hugo697 879 days ago
Submitted by hugo697 Typescript (fetch-only)
Verified 327 days ago
1
type Jira = {
2
  username: string;
3
  password: string;
4
  domain: string;
5
};
6
/**
7
 * Delete app property
8
 * Deletes an app's property.
9

10
**[Permissions](#permissions) required:** Only a Connect app whose key matches `addonKey` can make this request.
11
Additionally, Forge apps can access Connect app properties (stored against the same `app.connect.key`).
12
 */
13
export async function main(auth: Jira, addonKey: string, propertyKey: string) {
14
  const url = new URL(
15
    `https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/addons/${addonKey}/properties/${propertyKey}`
16
  );
17

18
  const response = await fetch(url, {
19
    method: "DELETE",
20
    headers: {
21
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
22
    },
23
    body: undefined,
24
  });
25
  if (!response.ok) {
26
    const text = await response.text();
27
    throw new Error(`${response.status} ${text}`);
28
  }
29
  return await response.text();
30
}
31