Hello !
I’m trying to use the APIs to call scripts that are managed by Automation and I wonder if there is a way to catch the authentication token (bearer token) passed to the API and re-use it to call UAscript from the API script section ?
For instance, I create an API [GET] with authentication which is called /dev/:module/:method
. This API can receive query for multiple “modules” and various “methods” routed, at the moment, with a simple switch like:
switch ($module) {
"cm" {
Invoke-UAScript -Script "Import-CMConfiguration" -Method GET -Function $method
}
Default {
"module not defined"
}
}
but in this situation, I have to import Universal Module, connect to the UAServer with authentication in order to invoke a UAScript and pass parameters and thus I’m wondering if Bearer Token passed to the initial API call can be reused to Connect to UAServer ?
I hope this is clear enough, feel free to let me know if I need to clarify anything.
Many thanks in advance !