0

Edit Hour Record

by
Published Oct 17, 2025

Edit an hour record

Script bamboo_hr Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Edit Hour Record
4
 * Edit an hour record
5
 */
6
export async function main(auth: RT.BambooHr, body: Body) {
7
	const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/timetracking/adjust`)
8

9
	const response = await fetch(url, {
10
		method: 'PUT',
11
		headers: {
12
			'Content-Type': 'application/json',
13
			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
14
		},
15
		body: JSON.stringify(body)
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

24
/* eslint-disable */
25
/**
26
 * This file was automatically generated by json-schema-to-typescript.
27
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
28
 * and run json-schema-to-typescript to regenerate this file.
29
 */
30

31
/**
32
 * Schema for adjust time tracking request body
33
 */
34
export interface Body {
35
	/**
36
	 * The time tracking id is the id that was used to track the record up to 36 characters in length. (i.e. UUID).
37
	 */
38
	timeTrackingId: string
39
	/**
40
	 * The updated number of hours worked. e.g. if Employee A worked 8.0 hours originally and decided they only worked 6.0, please send 6.0 here not -2.0.
41
	 */
42
	hoursWorked: number
43
	/**
44
	 * ID of the project associated with this time tracking record
45
	 */
46
	projectId?: number | null
47
	/**
48
	 * ID of the task associated with this time tracking record
49
	 */
50
	taskId?: number | null
51
	/**
52
	 * ID of the shift differential associated with this time tracking record
53
	 */
54
	shiftDifferentialId?: number | null
55
	/**
56
	 * ID of the holiday associated with this time tracking record
57
	 */
58
	holidayId?: number | null
59
	[k: string]: unknown
60
}
61