get job result by id

Script windmill Verified

by admin ยท 8/13/2023

The script

Submitted by admin Typescript (fetch-only)
Verified 370 days ago
1
/**
2
 * get job result by id
3
 *
4
 */
5
export async function main(
6
  workspace: string,
7
  flow_job_id: string,
8
  node_id: string
9
) {
10
  const url = new URL(
11
    `${BASE_URL}/api/w/${workspace}/jobs/result_by_id/${flow_job_id}/${node_id}`
12
  );
13

14
  const response = await fetch(url, {
15
    method: "GET",
16
    headers: {
17
      Authorization: "Bearer " + WM_TOKEN,
18
    },
19
    body: undefined,
20
  });
21
  if (!response.ok) {
22
    const text = await response.text();
23
    throw new Error(`${response.status} ${text}`);
24
  }
25
  return await response.json();
26
}
27