Consumed REST API only works via test


I am consuming an authentication REST API from our MicroStrategy BI tool.   This API is a POST method where we send the User ID and Password, and it returns a token in the response header (there is no body to the response).

When I test the API I get a 204 success response, but when I actually pull the API into an action it returns a 401 failed auth response.  I have even tried to add an onBeforeRequest step to hard code the body from the test call to the customized body, but it still returns a 401 error.   Any suggestions on what I could be missing?


Also, assuming I do get this to work how do I extract the response header values?   I can see them in the onAfterResponse step but I'm not entirely sure how to expose those to my logic for the next step. 


Screenshot from Testing 


Screenshot showing that I am appending the known good body to the customized request

 

Screenshot showing the debugger customized Request values



Did you changed credentials recently?If yes,consider deleting browser cache if authorizing using the crednentials via login page of application and try accesing it once again as 401 error clearly depicts invalid credntials or Misloading of page happened.


Naren wrote:

Did you changed credentials recently?If yes,consider deleting browser cache if authorizing using the crednentials via login page of application and try accesing it once again as 401 error clearly depicts invalid credntials or Misloading of page happened.


No, we consumed this API for the first time yesterday and it has never worked other than when running via test.   However it does work through SOAPUI using the same body and URL that we have configured.   So something is happening with the way Outsystems is appending the data to the request....but I can't figure out what exactly.


Solution

I found the issue and a solution.   The MicroStrategy APIs required type "application/json" which was being appended properly.  However Outsystems was also adding UTF-8 which caused the MicroStrategy return the 401 error.

I added a OnBeforeRequest step to strip the UTF-8 from the header value and that corrected the issue.   It does seem odd that the value is being added automatically but at least I found a work around.

Solution

Cheers!