0

Get research task

Published today

Retrieve a Linkup research task by id, with its status and, once completed, its output.

Script linkup Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 3 hours ago
1
//native
2

3
/**
4
 * Get research task
5
 * Retrieve a Linkup research task by id, with its status and, once completed, its output.
6
 */
7
export async function main(auth: RT.Linkup, research_id: string) {
8
  const url = new URL(
9
    `https://api.linkup.so/v1/research/${encodeURIComponent(research_id)}`
10
  )
11

12
  const response = await fetch(url, {
13
    method: "GET",
14
    headers: {
15
      Authorization: `Bearer ${auth.token}`,
16
      Accept: "application/json",
17
    },
18
  })
19

20
  if (!response.ok) {
21
    throw new Error(`${response.status} ${await response.text()}`)
22
  }
23

24
  return await response.json()
25
}
26