Quantcast
Channel: OutSystems Community
Viewing all articles
Browse latest Browse all 1476385

[Ideas] Enable changing of rest api response out off the OnResponse handler

$
0
0

We are facing many blocking issues trying surpass the default limitations of rest api on exception handling and standardization of responses.

I have related all the scenário on this other idea where I'm suggesting to free some of the blocking issues we are facing.

https://www.outsystems.com/ideas/6943/add-exception-handling-on-exposed-rest-api


To be more precise here I will paste some of the content, as all of issues are blocking some solution.


The lack of not having an error handler on exposed rest api block us on having a decent exception handling on rest api.

In our case we are trying to implement and harmonize the behavior of our web apis on many platforms in many ways as:

The standardization of responses and exception handling not only to status codes but the standardization of json structure of validations and error handling.

Said that, we tried many things, all finding any sort of Outsystems limitations.

PS: We don'twant to do manual validation on all our actions and raise exceptions after manually change the status codes and duplicate the exception messages. It open for many breaks to standardization and falls in the message duplication of exceptions in OS as stated below.


The exception approach:

Exceptions in OS:

Can't be public and can't be referenced between modules;

Need to specify a exception message on all raises, causing non standardization and duplication

Need duplication and I think duplicated one aren't caught on specific handlers with same name, only generic ones;

Almost ten years ago Gonçalo Borrêga already suggested changes on this: https://www.outsystems.com/ideas/100/Allow+custom+Exceptions+to+be+public+and+referenced+from+other+espaces?IsFromAdvancedSearch=True

The default built-in exception handler of rest api returns almost all time a status code 500. Not the more adequate.

Second try:

Tried to use exception handlers in OnResponse rest api handler:

But when it runs, the exception handler never runs;

I made some helper actions on a helper module to get the standardization of status codes.

With the helper centralized actions I could standardize the status codes at least, but can't make any sort of data validation exchange between action and handler, as there is no way to pass data do the handler nor made any changes to response out of the OnResponse handler. Then my Bad Request scenarios are not solved by this approach.


At this point I can't detail to the client of my apis what not passed the validations.

To complete this, the use of structures as parameters on api doesn't have mandatory and data type validations!

I will cover all of the lacks on individual ideas and a forum post with all of it.

Hope someone else can converge on need for some changes on this.

Márcio.


Viewing all articles
Browse latest Browse all 1476385

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>