I built a dashboard a while back using Universal Dashboard and I’m attempting to replicated in Powershell Universal but not getting any results.
This is what it looked like in Universal Dashboard.
import-module UniversalDashboard
$SQLQueries = . (Join-Path $PSScriptRoot “\SQLQueries.ps1”)
$TransactionLookUp = New-UDEndpoint -Url ‘TransLookUp/:UniqueID’ -Endpoint{
param($UniqueID)$Cache:TransactionsData | Where-Object UniqueIDCopy -EQ $UniquetID | ConvertTo-Json
}
Start-UDRestApi -Endpoint $TransactionLookUp -Port 10001 -Force
Running Invoke-Restmethod http://localhost:10001/api/TransLookUp/305
Would display the right results.
To replicate this behavior I tried going to http://localhost:5000/admin/
and adding a new endpoint /TransLookUp/:BudgetID.
Below is what the endpoint looked like in the first attempt.
.“C:\ProgramData\UniversalAutomation\Repository\Dashboard\SQLQueries.ps1”
New-PSUEndpoint -Url “/TransLookUp/:UniqueID” -Endpoint {
param($UniqueID)$Cache:TransactionsData | Where-Object UniqueIDCopy -EQ $UniquetID | ConvertTo-Json
}
No results were shown when running Invoke-RestMethod -Uri "http://localhost:5000/TransLookUp/305" -Method GET
Then I thought that maybe it wasn’t reading the file I referenced so I wrote the SQL queries within the endpoint but I still just got []
And yes, I know for a fact that $Cache:TransactionsData is not empty because I use that same data to produce a chart.