0

Get Data from Dataset

by
Published Oct 17, 2025

Use this resource to request data from the specified dataset.

Script bamboo_hr Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Get Data from Dataset
4
 * Use this resource to request data from the specified dataset.
5
 */
6
export async function main(auth: RT.BambooHr, datasetName: string, body: Body) {
7
	const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/datasets/${datasetName}`)
8

9
	const response = await fetch(url, {
10
		method: 'POST',
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
export interface Body {
32
	fields: string[]
33
	aggregations?: {
34
		field?: string
35
		aggregation?: 'count' | 'sum' | 'avg' | 'min' | 'max'
36
		[k: string]: unknown
37
	}[]
38
	sortBy?: {
39
		field?: string
40
		sort?: 'asc' | 'desc'
41
		[k: string]: unknown
42
	}[]
43
	filters?: {
44
		match?: string
45
		filters?: {
46
			field?: string
47
			operator?:
48
				| 'contains'
49
				| 'does_not_contain'
50
				| 'equal'
51
				| 'not_equal'
52
				| 'empty'
53
				| 'not_empty'
54
				| 'lt'
55
				| 'lte'
56
				| 'gt'
57
				| 'gte'
58
				| 'last'
59
				| 'next'
60
				| 'range'
61
				| 'checked'
62
				| 'not_checked'
63
				| 'includes'
64
				| 'does_not_include'
65
			value?: unknown
66
			[k: string]: unknown
67
		}[]
68
		[k: string]: unknown
69
	}
70
	groupBy?: string[]
71
	[k: string]: unknown
72
}
73