Public/Curanet/Get-CuranetCustomerSubscriptions.ps1
function Get-CuranetCustomerSubscriptions() { Param( [Parameter(Mandatory)] [string]$CustomerId ) # Get a Curanet 3850 API access token $AccessToken = Get-AccessToken $AuthorizationHeader = @{ Authorization="Bearer $AccessToken" } try { $Subscriptions = (Invoke-WebRequest -Uri "https://api.curanet.dk/customers/v1/Customers/$($CustomerId)/Subscriptions" -Headers $AuthorizationHeader -UseBasicParsing -Method GET).Content | ConvertFrom-Json } catch { throw "Failed to retreive subscriptions from Curanet 3850 API: $_" } return $Subscriptions } |