Edits history of script submission #14171 for ' Get Hiring Leads (bamboo_hr)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Get Hiring Leads
     * Get potential hiring leads for use in creating a new job opening. The owner of the API key used must have access to ATS settings.
     */
    export async function main(auth: RT.BambooHr) {
    	const url = new URL(
    		`https://${auth.companyDomain}.bamboohr.com/api/v1/applicant_tracking/hiring_leads`
    	)
    
    	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