0

Get Cloud ID

by
Published 7 days ago

Get the cloud ID of the Jira site. The scripts here don't need it (they call the site directly), but OAuth apps, Forge and the api.atlassian.com gateway address a site by this ID.

Script jira Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 8 days ago
1
//native
2

3
/**
4
 * Get Cloud ID
5
 * Get the cloud ID of the Jira site. The scripts here don't need it (they call the site directly), but OAuth apps, Forge and the api.atlassian.com gateway address a site by this ID.
6
 */
7
export async function main(auth: RT.Jira) {
8
  const url = new URL(`https://${auth.domain}.atlassian.net/_edge/tenant_info`)
9

10
  const response = await fetch(url, {
11
    method: "GET",
12
    headers: {
13
      Accept: "application/json",
14
    },
15
  })
16

17
  if (!response.ok) {
18
    throw new Error(`${response.status} ${await response.text()}`)
19
  }
20

21
  return await response.json()
22
}
23