resume a job for a suspended flow as an owner

Script windmill Verified

by admin ยท 8/13/2023

The script

Submitted by admin Typescript (fetch-only)
Verified 370 days ago
1
/**
2
 * resume a job for a suspended flow as an owner
3
 *
4
 */
5
export async function main(
6
  workspace: string,
7
  id: string,
8
  body: { [k: string]: unknown }
9
) {
10
  const url = new URL(`${BASE_URL}/api/w/${workspace}/jobs/flow/resume/${id}`);
11

12
  const response = await fetch(url, {
13
    method: "POST",
14
    headers: {
15
      "Content-Type": "application/json",
16
      Authorization: "Bearer " + WM_TOKEN,
17
    },
18
    body: JSON.stringify(body),
19
  });
20
  if (!response.ok) {
21
    const text = await response.text();
22
    throw new Error(`${response.status} ${text}`);
23
  }
24
  return await response.text();
25
}
26