Edits history of script submission #23373 for ' Check Issues Against JQL (jira)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Check Issues Against JQL
     * Check which of the given issues match each of one or more JQL queries. Takes numeric issue IDs (not keys) and returns, per query, the matched IDs.
     */
    export async function main(auth: RT.Jira, issue_ids: number[], jqls: string[]) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/3/jql/match`
      )
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          Authorization: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify({ issueIds: issue_ids, jqls }),
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 8 days ago