0

Add/Edit Timesheet Hour Entries

by
Published Oct 17, 2025

Add or edit timesheet hour entries.

Script bamboo_hr Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Add/Edit Timesheet Hour Entries
4
 * Add or edit timesheet hour entries.
5
 */
6
export async function main(auth: RT.BambooHr, body?: Body) {
7
	const url = new URL(
8
		`https://${auth.companyDomain}.bamboohr.com/api/v1/time_tracking/hour_entries/store`
9
	)
10

11
	const response = await fetch(url, {
12
		method: 'POST',
13
		headers: {
14
			'Content-Type': 'application/json',
15
			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
16
		},
17
		body: JSON.stringify(body)
18
	})
19
	if (!response.ok) {
20
		const text = await response.text()
21
		throw new Error(`${response.status} ${text}`)
22
	}
23
	return await response.json()
24
}
25

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

33
/**
34
 * Schema for timesheet hour entries request
35
 */
36
export interface Body {
37
	/**
38
	 * Array of hour entries to add or update
39
	 */
40
	hours: {
41
		/**
42
		 * Unique identifier for the employee
43
		 */
44
		employeeId?: number
45
		/**
46
		 * Date for the timesheet entry. Must be in YYYY-MM-DD format
47
		 */
48
		date?: string
49
		/**
50
		 * Hours worked for this timesheet entry
51
		 */
52
		hours?: number
53
		/**
54
		 * The ID of an existing timesheet entry. This can be specified to edit an existing entry
55
		 */
56
		id?: number
57
		/**
58
		 * The ID of the project to associate with the timesheet entry
59
		 */
60
		projectId?: number
61
		/**
62
		 * The ID of the task to associate with the timesheet entry
63
		 */
64
		taskId?: number
65
		/**
66
		 * Optional note to associate with the timesheet entry
67
		 */
68
		note?: string
69
		[k: string]: unknown
70
	}[]
71
	[k: string]: unknown
72
}
73