0

Gets all updated employee table data

by
Published Oct 17, 2025

This API is merely an optimization to avoid downloading all table data for all employees. When you use this API you will provide a timestamp and the results will be limited to just the employees that have changed since the time you provided. This API operates on an employee-last-changed-timestamp, which means that a change in ANY field in the employee record will cause ALL of that employees table rows to show up via this API.

Script bamboo_hr Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Gets all updated employee table data
4
 * This API is merely an optimization to avoid downloading all table data for all employees. When you use this API you will provide a timestamp and the results will be limited to just the employees that have changed since the time you provided. This API operates on an employee-last-changed-timestamp, which means that a change in ANY field in the employee record will cause ALL of that employees table rows to show up via this API.
5
 */
6
export async function main(auth: RT.BambooHr, table: string, since: string | undefined) {
7
	const url = new URL(
8
		`https://${auth.companyDomain}.bamboohr.com/api/v1/employees/changed/tables/${table}`
9
	)
10
	for (const [k, v] of [['since', since]]) {
11
		if (v !== undefined && v !== '') {
12
			url.searchParams.append(k, v)
13
		}
14
	}
15
	const response = await fetch(url, {
16
		method: 'GET',
17
		headers: {
18
			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
19
		},
20
		body: undefined
21
	})
22
	if (!response.ok) {
23
		const text = await response.text()
24
		throw new Error(`${response.status} ${text}`)
25
	}
26
	return await response.text()
27
}
28