type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Get approximate application license count
* Returns the total approximate number of user accounts for a single Jira license. Note that this information is cached with a 7-day lifecycle and could be stale at the time of call.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
applicationKey:
| "jira-core"
| "jira-product-discovery"
| "jira-software"
| "jira-servicedesk"
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/license/approximateLicenseCount/product/${applicationKey}`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 327 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Get approximate application license count
* Returns the total approximate number of user accounts for a single Jira license. Note that this information is cached with a 7-day lifecycle and could be stale at the time of call.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
applicationKey:
| "jira-core"
| "jira-product-discovery"
| "jira-software"
| "jira-servicedesk"
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/license/approximateLicenseCount/product/${applicationKey}`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 879 days ago