![]() |
VOOZH | about |
The CData API Driver for ADO.NET is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to BambooHR.
The ADO.NET Provider provides a SQL interface for BambooHR; this tutorial shows how to use the Provider to retrieve BambooHR data.
Once you have acquired the necessary connection properties, accessing BambooHR data in PowerShell can be enabled in three steps.
Start by setting the Profile connection property to the location of the BambooHR Profile on disk (e.g. C:\profiles\bamboohr.apip). Next, set the ProfileSettings connection property to the connection string for BambooHR (see below).
In order to authenticate to BambooHR, you'll need to provide your API Key. To generate an API key, log in and click your name in the upper right-hand corner of any page to get to the user context menu. If you have sufficient permissions, there will be an "API Keys" option in that menu to go to the page, where you can create a new API Key. Additionally, set the Domain, found in the domain name of your BambooHR account. For example if your BambooHR account is acmeinc.bamboohr.com, then the Domain should be 'acmeinc'. Set both the API Key and Domain in the ProfileSettings property to connect.
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData API Driver for ADO.NET\lib\System.Data.CData.API.dll")
Connect to BambooHR:
$conn= New-Object System.Data.CData.API.APIConnection("Profile=C:\profiles\BambooHR.apip;ProfileSettings='Domain=acmeinc;APIKey=your_api_key';")
$conn.Open()
Instantiate the APIDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Id, DisplayName from Employees"
$da= New-Object System.Data.CData.API.APIDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.id $_.displayname
}
Connect to live data from BambooHR with the API Driver
Connect to BambooHR