I am currently working on API workflows for Orchestrator APIs for an Agent.
I have authenticated via swagger and tested a couple of APIs within SWAGGER ( e.g. releases, processes, Robot Logs)
I have provided the Get URL, Bearer token, and Accept Application/json as arguments
However when I test in Studio- API workflows it runs Fine when I an debugging/testing, but after a while it fails to get the API HTTP Request. (see image)
How can I confirm, given the authentication that it will always work when querying via an Agent?
Hi, @ashton.lalchan This usually happens because your Bearer token expires after a while. Try refreshing or requesting a new token automatically in your workflow whenever you get an “unauthorized” error. That way your API calls will stay reliable even when running unattended
Thanks for the response, is there a specific activity/property for this in the API workflow?
I ask becuase the bearer token was manually entered in the workflow for the HTTP request. I dont see an option to have it automatically generate thereafter.
@ashton.lalchan Just add an HTTP Request before your main API call to get a new Bearer token using your client credentials. Store that token in a variable and use it in the Authorization header. If your API call fails with “unauthorized,” fetch a new token and retry. This keeps your calls running even when tokens expire.
@ashton.lalchan you need to use a separate workflow, a custom connector or manage authentication through an external application/Integration Service. Sorry for any confusion earlier this clarification should help keep your project on the right track.
A token copied from Swagger is temporary. For unattended calls, use an Integration Service connection with OAuth client credentials for a confidential UiPath External App, then select that connection in the HTTP activity. The authentication framework handles token acquisition; don’t pass the access token through the agent prompt.
The app still needs the relevant Orchestrator application scopes and folder permissions. Test releases/processes/logs under that app identity, since Swagger tested your user identity. Check the actual failed HTTP status too: token renewal can address an expired-token 401, but it won’t fix a 403 caused by missing access.