Ready to get started?

Download a free trial of the Pinterest Data Provider to get started:

 Download Now

Learn more:

Pinterest Icon Pinterest ADO.NET Provider

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

Automate Pinterest Integration Tasks from PowerShell



Are you in search of a quick and easy way to access Pinterest data from PowerShell? This article demonstrates how to utilize the Pinterest Cmdlets for tasks like connecting to Pinterest data, automating operations, downloading data, and more.

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

PowerShell Cmdlets or ADO.NET Provider?

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

Once you have acquired the necessary connection properties, accessing Pinterest data in PowerShell can be enabled in three steps.

Pinterest authentication is based on the standard OAuth flow. To authenticate, you must initially create an app via the Pinterest developer platform where you can obtain an OAuthClientId, OAuthClientSecret, and CallbackURL.

Set InitiateOAuth to GETANDREFRESH and set OAuthClientId, OAuthClientSecret, and CallbackURL based on the property values for the app you created.

See the Help documentation for other OAuth authentication flows.

PowerShell

  1. Install the module:

    Install-Module PinterestCmdlets
  2. Connect:

    $pinterest = Connect-Pinterest -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackURL "$CallbackURL"
  3. Search for and retrieve data:

    $firstname = "Jane" $users = Select-Pinterest -Connection $pinterest -Table "Users" -Where "FirstName = `'$FirstName`'" $users

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

    $users = Invoke-Pinterest -Connection $pinterest -Query 'SELECT * FROM Users WHERE FirstName = @FirstName' -Params @{'@FirstName'='Jane'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Pinterest.PinterestConnection("OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CallbackURL='https://localhost:33333'InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the PinterestDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, Username from Users" $da= New-Object System.Data.CData.Pinterest.PinterestDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.id $_.username }