Automate ShipStation Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

ShipStation ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with ShipStation.



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

The CData Cmdlets for ShipStation are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to ShipStation.

Cmdlets or ADO.NET?

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

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

Use the BASIC Authentication standard to connect.

  1. Login to your ShipStation account
  2. Click on the settings icon in the upper right corner. A column menu will show up on the left
  3. Click Account -> API Settings
  4. On the API Settings page, note the API Key and API Secret.

Authenticating to ShipStation

  • APIKey: Set this to the API key from the API settings page.
  • APISecret: Set this to the Secret key from the API settings page.

PowerShell

  1. Install the module:

    Install-Module ShipStationCmdlets
  2. Connect:

    $shipstation = Connect-ShipStation -APIKey "$APIKey" -APISecret "$APISecret"
  3. Search for and retrieve data:

    $customerid = "1368175" $tags = Select-ShipStation -Connection $shipstation -Table "Tags" -Where "CustomerId = `'$CustomerId`'" $tags

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

    $tags = Invoke-ShipStation -Connection $shipstation -Query 'SELECT * FROM Tags WHERE CustomerId = @CustomerId' -Params @{'@CustomerId'='1368175'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.ShipStation.ShipStationConnection("APIKey='YourAPIKey';APISecret='YourAPISecret'") $conn.Open()
  3. Instantiate the ShipStationDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, Color from Tags" $da= New-Object System.Data.CData.ShipStation.ShipStationDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.id $_.color }