Edits history of script submission #3606 for ' Check issues against JQL (jira)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Check issues against JQL
     * Checks whether one or more issues would be returned by one or more JQL queries.
    
    **[Permissions](#permissions) required:** None, however, issues are only matched against JQL queries where the user has:
    
     *  *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
     *  If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
     */
    export async function main(
      auth: Jira,
      body: { issueIds: number[]; jqls: string[] }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/jql/match`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 396 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Check issues against JQL
     * Checks whether one or more issues would be returned by one or more JQL queries.
    
    **[Permissions](#permissions) required:** None, however, issues are only matched against JQL queries where the user has:
    
     *  *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
     *  If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
     */
    export async function main(
      auth: Jira,
      body: { issueIds: number[]; jqls: string[] }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/api/2/jql/match`
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 948 days ago