Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX: Handling Errors in Rest API response in Interactive Grid

Jerry SebastianNov 23 2022 — edited Nov 23 2022

Hi All,

We are building an interactive grid APEX page on a rest data source. The rest data source is created over rest apis developed in ORDS and supports various HTTP methods, such as GET, POST, DELETE etc. which are mapped to various IG functions as Query, Update, Insert, Delete etc.
We could get the interactive grid work for most of our transactions without any issues. However, if an error is returned from the POST API on update of a row in the IG, we are unable to trap the error and show the error message returned by the API. As an example, if everything goes well, API Response is as below.

HTTP Status Code:200
HTTP Response body: {"message":"records updated successfully, number of records=181"}
This reflects in the APEX page as "Changes Saved"
If the business validations fail at the API backend, the API response is as below
HTTP Status Code:400
HTTP Response body: {"message":"Invalid update, employee is not eligible for this leave type"}
This shows as below error message in the UI
"ORA-20999: REST Data Source returned an HTTP error: HTTP 400: Bad request"
Is there anyway we could capture the message from the response body and show it in the screen?

This post has been answered by Evgeniia Burenko on Jan 8 2025
Jump to Answer
Comments
Post Details
Added on Nov 23 2022
3 comments
1,330 views