i want to throw json format error as Api Response for Unautherization like below
{ "Error": "Invalid username or password.", "StatusCode": 401 }but if i use setStatusCode Action for 401 error code then it is throwing below errorhow to fix it please help me.
Hi Santhu MS,
The SetStatusCode from HTTPrequesthandler only sets status codes of the current HTTP response:
https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/HTTPRequestHandler_API#SetStatusCode
Please refer to this post to have an idea how to validate JSON formats:
https://www.outsystems.com/forums/discussion/36158/how-to-check-if-it-is-a-valid-json-format/
Kind regards,Nordin
Hi Santhu,
On what version of the Platform are you?
In O10 the default on IIS is classic pipeline on the application pool. That makes IIS override any output on a 401 status code.
At some point during O10 the Integrated Pipeline started to be supported as a opt-in that required manual intervention in IIS. Not sure if just changing the pipeline mode is sufficient to overcome the IIS limitation or if some extra work need to be done.
Regards,
João Rosado
João Rosado wrote:
hi Rosado
sorry for late replay i am working in outsystem 10.i dont know how to change pipeline can you please give solution to do that
thank you
Santhu
Hi,
First ensure that you are in a version that already supports the integrated pipeline. On O10 it was added support on 10.0.502.0
I'm not on my work machine at the moment so cannot take a screenshot, but you need to go to IIS, select on the tree the "Application Pools" and then on the properties for the "OutSystemsApplications" change from Classic to Integrated.
Tell me if that was enough to solve your problem.
sorry for late replay. my outsystem version is 10.0
thanks
santhu
By the way, did a quick test on my personal environment (that is on O11 so it forces integrated pipeline) and it worked fine getting a custom response on a 401 without any further changes:
On O10 it was added support on 10.0.502.0 on the Platform Server release, so you need to tell me and check a bit more than 10.0
If you are before the revision that I said you cannot overcome that limitation
If you are after it, then you can fix it with the above steps.