HTTP client to interact with the Kronos REST API
npm install @jetpropilots/kronos-client
The client requires the following env variables to be set.
KRONOS_API
KRONOS_API_KEY
KRONOS_USERNAME
KRONOS_PASSWORD
KRONOS_PASSWORD
KRONOS_COMPANY
The client supports the following optional vars to use a proxy
PROXY_HOST
PROXY_PORT
Note: authentication is handled implicitly ( assuming the correct environment variables are set). Just call the methods you need and the client will login and refresh as needed.
const client = require('@jetpropilots/kronos-client')
async function main() {
try {
const data = await client.jobRequisitions()
console.log('data', data)
const first = data.job_requisitions[0]
const detail = await client.jobRequisition(first.id)
console.log('detail', detail)
const employees = await client.getEmployees() // get all employees ( small dtos ... do not have all fields )
console.log('employees', employees)
const dto = employees[0] // get first employee for example
console.log('dto', dto)
const employee = await client.getEmployee(dto.id) // get full employee
console.log('employee', employee)
process.exit(0)
} catch (e) {
console.error(e)
process.exit(-1)
}
}
main()