Is there a way to call a route internally in a REST API route ??
I want a “global” route to make calls to other routes internally …
at the moment i’m doing something like that:
$Test = New-UDEndpoint -Url "/Test/:id" -Method POST -Endpoint {
Param($id)
$id
}
$Global = New-UDEndpoint -Url "/Global/:id" -Method POST -Endpoint {
Param($id)
## it's working, but it feels weird :)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$a = Invoke-RestMethod -Method Post "https://myserver/api/test/someID" -Body '{"id":$id}'
## do some stuff
}
Is there another way to do this without using invoke-restmethod ?