Edits history of script submission #14155 for ' Get All Aggregate Goal Info, Version 1.2 (bamboo_hr)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Get All Aggregate Goal Info, Version 1.2
     * Provides a list of all goals, type counts, filter actions, goal comment counts, and employees shared with goals for the given employee. Difference from Version 1.1: Returns all goals, including goals that contain milestones.
     */
    export async function main(auth: RT.BambooHr, employeeId: string) {
    	const url = new URL(
    		`https://${auth.companyDomain}.bamboohr.com/api/v1_2/performance/employees/${employeeId}/goals/aggregate`
    	)
    
    	const response = await fetch(url, {
    		method: 'GET',
    		headers: {
    			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 235 days ago