Get workflow transition rule configurations

Returns configurations for workflow transition rules migrated from server to cloud and owned by the calling Connect app.

Script jira Verified

by hugo697 ยท 11/2/2023

The script

Submitted by hugo697 Typescript (fetch-only)
Verified 396 days ago
1
type Jira = {
2
  username: string;
3
  password: string;
4
  domain: string;
5
};
6
/**
7
 * Get workflow transition rule configurations
8
 * Returns configurations for workflow transition rules migrated from server to cloud and owned by the calling Connect app.
9
 */
10
export async function main(
11
  auth: Jira,
12
  Atlassian_Transfer_Id: string,
13
  body: {
14
    expand?: string;
15
    ruleIds: string[];
16
    workflowEntityId: string;
17
    [k: string]: unknown;
18
  }
19
) {
20
  const url = new URL(
21
    `https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/migration/workflow/rule/search`
22
  );
23

24
  const response = await fetch(url, {
25
    method: "POST",
26
    headers: {
27
      "Atlassian-Transfer-Id": Atlassian_Transfer_Id,
28
      "Content-Type": "application/json",
29
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
30
    },
31
    body: JSON.stringify(body),
32
  });
33
  if (!response.ok) {
34
    const text = await response.text();
35
    throw new Error(`${response.status} ${text}`);
36
  }
37
  return await response.json();
38
}
39