Ready to get started?

Learn more about the CData ADO.NET Provider for EDGAR Online or download a free trial:

Download Now

Automate EDGAR Online Integration Tasks from PowerShell

Are you looking for a quick and easy way to access EDGAR Online data from PowerShell? We show how to use the Cmdlets for EDGAR Online and the CData ADO.NET Provider for EDGAR Online to connect to EDGAR Online data and synchronize, automate, download, and more.

The CData Cmdlets for EDGAR Online 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 EDGAR Online.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the EDGAR Online API, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete EDGAR Online data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for EDGAR Online. To access EDGAR Online data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for EDGAR Online.

After obtaining the needed connection properties, accessing EDGAR Online data in PowerShell consists of three basic steps.

  1. Navigate to https://developer.edgar-online.com/ and create an account.
  2. Register a new application and retrieve the AppKey. You should select one of the available Web APIs this application will use like HackPack, Insider Trades or Institutional Ownership.
    Note: HackPack is the most important Web API that an application can use since it supports a large number of endpoints. If you are getting the "Access Denied" error you must create a new app and select the correct Web API which supports the resource you are querying.
  3. After successfully creating a new app, you can access your keys through your "my account" area. Set the AppKey connection property value equal to the Key of your application.

PowerShell

  1. Install the module:

    Install-Module EdgarOnlineCmdlets
  2. Connect:

    $edgaronline = Connect-EdgarOnline -AppKey "$AppKey"
  3. Search for and retrieve data:

    $subscriberemail = "user@domain.com" $subscriptions = Select-EdgarOnline -Connection $edgaronline -Table "Subscriptions" -Where "SubscriberEmail = `'$SubscriberEmail`'" $subscriptions

    You can also use the Invoke-EdgarOnline cmdlet to execute SQL commands:

    $subscriptions = Invoke-EdgarOnline -Connection $edgaronline -Query 'SELECT * FROM Subscriptions WHERE SubscriberEmail = @SubscriberEmail' -Params @{'@SubscriberEmail'='user@domain.com'}

ADO.NET

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for EDGAR Online\lib\System.Data.CData.EdgarOnline.dll")
  2. Connect to EDGAR Online:

    $conn= New-Object System.Data.CData.EdgarOnline.EdgarOnlineConnection("AppKey=20dd8ce9904d422ed89ebde1ad40d") $conn.Open()
  3. Instantiate the EdgarOnlineDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, Name from Subscriptions" $da= New-Object System.Data.CData.EdgarOnline.EdgarOnlineDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.id $_.name }

Update EDGAR Online Data

PowerShell

Update-EdgarOnline -Connection $EdgarOnline -Columns @('Id','Name') -Values @('MyId', 'MyName') -Table Subscriptions -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.EdgarOnline.EdgarOnlineCommand("UPDATE Subscriptions SET SubscriberEmail='user@domain.com' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.EdgarOnline.EdgarOnlineParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert EDGAR Online Data

PowerShell

Add-EdgarOnline -Connection $EdgarOnline -Table Subscriptions -Columns @("Id", "Name") -Values @("MyId", "MyName")

ADO.NET

$cmd = New-Object System.Data.CData.EdgarOnline.EdgarOnlineCommand("INSERT INTO Subscriptions (SubscriberEmail) VALUES (@mySubscriberEmail)", $conn) $cmd.Parameters.Add(new System.Data.CData.EdgarOnline.EdgarOnlineParameter("@mySubscriberEmail","user@domain.com")) $cmd.ExecuteNonQuery()

Delete EDGAR Online Data

PowerShell

Remove-EdgarOnline -Connection $EdgarOnline -Table "Subscriptions" -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.EdgarOnline.EdgarOnlineCommand("DELETE FROM Subscriptions WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.EdgarOnline.EdgarOnlineParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()