API Endpoint redirect

Product: PowerShell Universal
Version: 1.5.15

Hello,

I need redirect from API Endpoint, is it possible to do redirect from API endpoint?
New-PSUApiResponse doesn’t have Header parameter to set Location: $url
I tried to do redirect using: Invoke-UDRedirect https://docs.ironmansoftware.com

Created dashboard with code:

New-UDDashboard -Title "Hello, World!" -Content {
    Get-Variable | ConvertTo-Json -depth 2 | Out-File "C:\psua\poc\UniversalAutomation\Data\Dashboard.json"
    New-UDTypography -Text "Hello $User"
    Invoke-UDRedirect https://docs.ironmansoftware.com
}

It’s not redirecting even like this above

Code work flow:

  • User authenticates using kerberos authentication
  • API Endpoint query user AD properties
  • Based on property value user redirected to one of defined Locations

Hey @vlad,

You can use the New-PSUApiResponse like this to perform a redirect.


New-PSUApiResponse -StatusCode 301 -Headers @{ Location = "https://www.google.com" }

Thank you! It works
It’s a pity what I didn’t check thread 7 hours ago :sob:
I was working on API Endpoint from yesterday, I finished my API Endpoint using different module, kerberos authentication works, it was good learning curve :slight_smile:

Also I see same warnings in logs for Universal Automation and for Module I used
Resulting JSON is truncated as serialization has exceeded the set depth of 2