cancel
Showing results for 
Search instead for 
Did you mean: 

Error Handling with API Gateway vs Service Layer in SAP

anrodse
Participant
0 Kudos
289

When using the Service Layer to post, for example, an order, I receive detailed error messages similar to what is displayed in the SAP Business One (SBO) client if something is not correct.

Now, I’m trying to migrate to the API Gateway to leverage new resources like reports. However, I’ve encountered an issue with error handling. In case of an error, I only receive a "503 Service Unavailable" response code, accompanied by the following response body:

 

{"code":503,"message": "Internal Server Error resulted from Runtime Exception"}

 

And it's the same for any endpoint or any kind of error.

How can I get more meaningful error messages when using the API Gateway, similar to what is provided by the Service Layer?

 

EDIT:

This is a postman example of error call to POST an order using Service Layer, with a clear error response with the message "Invalid BP code...":

anrodse_1-1736862206308.png

Same request to POST an incorrect order through API Gateway, using an API Gateway login token and same endpoint as before but using differen port, gives a 500 Internal Server Error with a generic body content, no matter what error I get.

 

Important to say that when I POST a correct json order I get the exact same json response using both APIs.

View Entire Topic
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi anrodse,

Please be aware that the Service Layer and API Gateway are two distinct entities.

Presently, the API Gateway is designed specifically to offer access to Crystal Reports as a service. It is not designed to handle the posting of transactions, such as Sales Orders or other types of transactions.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

anrodse
Participant
0 Kudos
API accepts service layer requests, and it works perfectly when json input bdoy is valid. Only problem here is that when we have an error I can't get useful error message.