How to customize the Built-in Error response returned from OS in case of invalid req.

Hi All,

I am trying to customize the built in error response returned from the platform in case of an invalid request being sent to the REST api exposed in Outsytems. 

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Expose_REST_APIs/Throw_a_Custom_Error_in_an_Exposed_REST_API


Can I customize the default error response returned for an invalid request? In this case,the request would have not reached the action flow where i can throw user defined exception along with the message.

Thanks,

KJ


Hello Karthik, are you referring to the message the IIS returns if the request is bad formed or the endpoint does not exist? 

You probably will have to deal with the IIS directly. 


Eduardo Jauch wrote:

Hello Karthik, are you referring to the message the IIS returns if the request is bad formed or the endpoint does not exist? 

You probably will have to deal with the IIS directly. 


Hi Eduardo, I need to customize the response returned by Outsystems platform incase of a bad request 

sample error message given in the documentation - https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Expose_REST_APIs/Throw_a_Custom_Error_in_an_Exposed_REST_API

1{
2    "Errors": [
3        "The 'Id' URL parameter is missing in the request.",
4        "The request body is missing."
5    ],
6    "StatusCode": 400
7}

Is there a way to customize this error response ?

Thanks,

KJ

Hi Karthik, 

Did you follow the stpes described there? 

Where are you having problems? You need to use the callbacks as explained in the documentation you provided. 

Like the OnRequest: https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Expose_REST_APIs/Preprocess_REST_API_Requests

Could you clarify what's your question exactly, or the missing information in the links that is causing trouble or is not clear enough? 

This way we xan help improving the documentation. 

Cheers 

But yes, ypu can customise the message to one of your like using the steps in the link. :) 

Eduardo Jauch wrote:

Hi Karthik, 

Did you follow the stpes described there? 

Where are you having problems? You need to use the callbacks as explained in the documentation you provided. 

Like the OnRequest: https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Expose_REST_APIs/Preprocess_REST_API_Requests

Could you clarify what's your question exactly, or the missing information in the links that is causing trouble or is not clear enough? 

This way we xan help improving the documentation. 

Cheers 

I followed the links and able to customize the error message for a valid request when there is an error in my execution logic, I did that by raising a manual exception with a response code and message defined in the logic. In a similar fashion, is there a way to customize the error response returned from the platform for a invalid request ?

I dont want the error response to be like the one shown below 

1{
2    "Errors": [
3        "The 'Id' URL parameter is missing in the request.",
4        "The request body is missing."
5    ],
6    "StatusCode": 400
7}


I want to customize the error response ? How can I use the OnRequest & OnResponse callback actions to do this ? Any additional documentation available on this part? 

Thanks,

KJ

Hi,

Then we go back to my first answer. 

I may be wrong, but Invalid requests (like invalid end-points, bad-formed requests, etc), I think, are not handled by the "platform", but by the IIS. So, if you want to customize, I think, this is not related to OutSystems, but to the Application Service IIS. 


Eduardo Jauch wrote:

Hi,

Then we go back to my first answer. 

I may be wrong, but Invalid requests (like invalid end-points, bad-formed requests, etc), I think, are not handled by the "platform", but by the IIS. So, if you want to customize, I think, this is not related to OutSystems, but to the Application Service IIS. 


Thanks Eduardo