0
get completed job result
One script reply has been approved by the moderators Verified
Created by admin 263 days ago Viewed 5413 times
0
Submitted by admin Typescript (fetch-only)
Verified 263 days ago
1
/**
2
 * get completed job result
3
 *
4
 */
5
export async function main(workspace: string, id: string) {
6
  const url = new URL(
7
    `${BASE_URL}/api/w/${workspace}/jobs_u/completed/get_result/${id}`
8
  );
9

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