![]() |
VOOZH | about |
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.
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.
Install the module:
Install-Module PinterestCmdlets
Connect:
$pinterest = Connect-Pinterest -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackURL "$CallbackURL" -InitiateOAuth "$InitiateOAuth"
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'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Pinterest\lib\System.Data.CData.Pinterest.dll")
Connect to Pinterest:
$conn= New-Object System.Data.CData.Pinterest.PinterestConnection("OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CallbackURL='https://localhost:33333';InitiateOAuth=GETANDREFRESH;")
$conn.Open()
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
}
Download a free trial of the Pinterest Data Provider to get started:
Download NowLearn more:
👁 Pinterest IconRapidly create and deploy powerful .NET applications that integrate with Pinterest.