We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →Automate Wave Financial Integration Tasks from PowerShell
Are you in search of a quick and easy way to access Wave Financial data from PowerShell? This article demonstrates how to utilize the Wave Financial Cmdlets for tasks like connecting to Wave Financial data, automating operations, downloading data, and more.
The CData Cmdlets for Wave Financial are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to Wave Financial.
PowerShell Cmdlets or ADO.NET Provider?
The Cmdlets are not only a PowerShell interface to Wave Financial, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Wave Financial data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Wave Financial. To access Wave Financial data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Wave Financial.
Once you have acquired the necessary connection properties, accessing Wave Financial data in PowerShell can be enabled in three steps.
Connect using the API Token
You can connect to Wave Financial by specifying the APIToken You can obtain an API Token using the following steps:
- Log in to your Wave account and navigate to "Manage Applications" in the left pane.
- Select the application that you would like to create a token for. You may need to create an application first.
- Click the "Create token" button to generate an APIToken.
Connect using OAuth
If you wish, you can connect using the embedded OAuth credentials. See the Help documentation for more information.
PowerShell
-
Install the module:
Install-Module WaveFinancialCmdlets
-
Connect:
$wavefinancial = Connect-WaveFinancial
-
Search for and retrieve data:
$status = "SENT" $invoices = Select-WaveFinancial -Connection $wavefinancial -Table "Invoices" -Where "Status = `'$Status`'" $invoices
You can also use the Invoke-WaveFinancial cmdlet to execute SQL commands:
$invoices = Invoke-WaveFinancial -Connection $wavefinancial -Query 'SELECT * FROM Invoices WHERE Status = @Status' -Params @{'@Status'='SENT'}
ADO.NET
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Wave Financial\lib\System.Data.CData.WaveFinancial.dll")
-
Connect to Wave Financial:
$conn= New-Object System.Data.CData.WaveFinancial.WaveFinancialConnection("InitiateOAuth=GETANDREFRESH") $conn.Open()
-
Instantiate the WaveFinancialDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Id, DueDate from Invoices" $da= New-Object System.Data.CData.WaveFinancial.WaveFinancialDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.id $_.duedate }
Update Wave Financial Data
PowerShell
Update-WaveFinancial -Connection $WaveFinancial -Columns @('Id','DueDate') -Values @('MyId', 'MyDueDate') -Table Invoices -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.WaveFinancial.WaveFinancialCommand("UPDATE Invoices SET Status='SENT' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.WaveFinancial.WaveFinancialParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()
Insert Wave Financial Data
PowerShell
Add-WaveFinancial -Connection $WaveFinancial -Table Invoices -Columns @("Id", "DueDate") -Values @("MyId", "MyDueDate")
ADO.NET
$cmd = New-Object System.Data.CData.WaveFinancial.WaveFinancialCommand("INSERT INTO Invoices (Status) VALUES (@myStatus)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.WaveFinancial.WaveFinancialParameter("@myStatus","SENT")))
$cmd.ExecuteNonQuery()
Delete Wave Financial Data
PowerShell
Remove-WaveFinancial -Connection $WaveFinancial -Table "Invoices" -Id "MyId"
ADO.NET
$cmd = New-Object System.Data.CData.WaveFinancial.WaveFinancialCommand("DELETE FROM Invoices WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.WaveFinancial.WaveFinancialParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()
CodeProject