189
Views
5
Comments
Solved
API 401 Unauthorized in logic transition
Service Studio Version
11.54.11 (Build 62451)

I am consuming an API to have the reports/attachments needed in the email I am to send, but I am encountering 401 unauthorized error in transition of the logic to send the email. The weird part is when I try it in POSTMAN, the response is 200 and no errors encountered. Also when I consume it in Outsystems, the result is also 200 and no error.  But when checking in the service center in the module where the API is used, error logged is 401 unauthorized. I triple checked the headers and it is correct. Anyone who encounter the same issue or you have ideas how to resolve this one

UserImage.jpg
RD.
Solution

Hello everyone, thanks for your messages. We tried the onbefore request and onafter response and we see the problem. We set the url in dev environment in outsystems, but when we check it in the logs in onbefore request, the url is pointing in the uat. What we did is to reconsume the API and the issue did not persist anymore. Weird part is we triple check the curl of the API and it is correct based on the documentation, but when we try the onbefore request, it seems the url is incorrect. Onbefore request and onafter response is useful and can be use as debugger in APIs specially when other application is the one triggering it.

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Hi @RD. ,
This API you are consuming is an external API?

If yes what is the type of authentication you are using?

If you are receiving a 401 error, most probably your credentials are not being accepted.

Without knowing more I would suggest for you to double check if the credentials being used are correct in Service Center, and if you are not changing any headers on the OnBefore request of your API on Service Studio.

Let me know if it makes sense,

Cheers 

RR :)

UserImage.jpg
Nani

Can you share more Details about Api which you are using

2024-09-27 19-05-42
Ravi Kumar Tasubilli

Hi,

401 error gets when the request lacks valid authentication credentials for the target resource.

Please check the permissions at the server.

Thanks,

Ravi

UserImage.jpg
Joseph Martin

Thank you.

UserImage.jpg
RD.
Solution

Hello everyone, thanks for your messages. We tried the onbefore request and onafter response and we see the problem. We set the url in dev environment in outsystems, but when we check it in the logs in onbefore request, the url is pointing in the uat. What we did is to reconsume the API and the issue did not persist anymore. Weird part is we triple check the curl of the API and it is correct based on the documentation, but when we try the onbefore request, it seems the url is incorrect. Onbefore request and onafter response is useful and can be use as debugger in APIs specially when other application is the one triggering it.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.