15
Views
7
Comments
Rest API no values showing error
Question

I have this API as the OML shows, that if I try to search for "test" it will return values but if try any other thing it will display an error.

How can I customize the consumed api to display no values to show instead of error 500 or any error related to that?

Departments.oml

Rank: #109

Hi Marco,

How does the API response looks like? Do you have sample to post here?


Regards,

Swatantra

mvp_badge
MVP
Rank: #71

Hi Marco,

Take a look at this success article by Rui Barbosa in order to learn all about handling and customizing REST errors. Approach #3 explains how to “silence” a REST error and convert it to return HTTP Status 200 instead in the OnAfterResponse event. Be aware that this is not considered a good practice and you must always introspect the error structure for errors.

There is also an example Forge component that comes with the article.

Hope this helps!

Regards,

Nordin

mvp_badge
MVP
Rank: #71

I would not consider that an error message since you have got a status 200 back from the API. I would consider it a success response from the API saying that it did not find whatever you were looking for. 

PS: since I am on my phone now I am unable to looking into your sample module.

mvp_badge
MVP
Rank: #71

Hi Marco,

Ok this is a deserialization error. May I ask, how did you consume the API?

I’m willing to take a look tomorrow. Meanwhile, here are some posts with similar issues that might give you a hint.

https://www.outsystems.com/forums/discussion/40058/json-deserialize-error/

https://www.outsystems.com/forums/discussion/32491/rest-api-problem-parsing-single-element-attribute-json-array-response/

Regards,

Nordin