Get app properties

Gets all the properties of an app. **[Permissions](#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`).

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 app properties
8
 * Gets all the properties of an app.
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) {
14
  const url = new URL(
15
    `https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/addons/${addonKey}/properties`
16
  );
17

18
  const response = await fetch(url, {
19
    method: "GET",
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.json();
30
}
31