PowerShell Script to Download Watch Lists to a CSV File

Below is a sample PowerShell script to download watch lists to a CSV file:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$OutputFile = 'c:\code\script\My.CSV'

$WebServiceHeader = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"

$WebServiceHeader.Add("Content-Type", 'application/json')

$WebServiceHeader.Add("Authorization", "Token YOUR_TOKEN_HERE" )

$URL = "https://api.app.secunia.com/api/asset-lists/export-assets/?asset_list=32&asset_list=1&asset_list=33&asset_list=34&asset_list=35&asset_list=36&asset_list=37&asset_list=38&asset_list=39&asset_list=40&asset_list=41&asset_type=product_release&format=json&export=csv&filename=export_20171010_152115"

(Invoke-RestMethod ($URL) -Method Get -Headers $WebServiceHeader) | Out-File $OutputFile