Get time entry history
One script reply has been approved by the moderators Verified

View a list of changes made to a time entry.

Created by hugo697 168 days ago
Submitted by hugo697 Bun
Verified 168 days ago
1
//native
2
type Clickup = {
3
  token: string;
4
};
5
/**
6
 * Get time entry history
7
 * View a list of changes made to a time entry.
8
 */
9
export async function main(
10
  auth: Clickup,
11
  team_id: string,
12
  timer_id: string,
13
  Content_Type: string,
14
) {
15
  const url = new URL(
16
    `https://api.clickup.com/api/v2/team/${team_id}/time_entries/${timer_id}/history`,
17
  );
18

19
  const response = await fetch(url, {
20
    method: "GET",
21
    headers: {
22
      "Content-Type": Content_Type,
23
      Authorization: auth.token,
24
    },
25
    body: undefined,
26
  });
27
  if (!response.ok) {
28
    const text = await response.text();
29
    throw new Error(`${response.status} ${text}`);
30
  }
31
  return await response.json();
32
}
33