Edits history of script submission #23387 for ' Get Cloud ID (jira)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Cloud ID
     * 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.
     */
    export async function main(auth: RT.Jira) {
      const url = new URL(`https://${auth.domain}.atlassian.net/_edge/tenant_info`)
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Accept: "application/json",
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 5 hours ago