Skip to main content

Hi All,

Assume we have a REST API which gives a response. In the documentation for Response Samples - Error 500, there is an array for details.
Why does it show as an array?
Normally , it is a single record for a database triggered error. 
 

Error 500

 

Hi,

By using an array, the API can accommodate multiple details for a single error response, which can be useful in scenarios where there are multiple issues or sub-errors associated with the main error. The array structure provides flexibility for capturing and communicating various error details in a consistent and standardized manner.

However using an array for the "details" field aligns with the guidelines and conventions followed in the OData specification, as mentioned in the OData documentation. Adhering to these standards ensures compatibility and consistency across OData-compliant systems and helps facilitate interoperability between different APIs. 

In summary, the representation of the "details" field as an array in the API documentation is in order to adhere to the OData guidelines for error handling.

Thanks,
Trewon Weerasooriya

 


@Trewon ,

Can you provide an API ( IFS REST API) where you have overridden the default behaviour and see multiple error details rather than one?
In IFS, when you raise an error (Error_SYS.Record_General) FW sends 500 error with a single error details record.
I would like to know how to override this behaviour and utilise this multiple error details as shown in the documentation.

Thanks
GaSoGB


Hi,

In IFS context, when you raise an error (Error_SYS.Record_General) you can only return a single error detail record. However it’s returned as an array through the rest endpoint in order to adhere to OData guidelines . Even though one detail is returned, it should be wrapped in an array to adhere to the OData protocol. 

Thanks,
Trewon Weerasooriya

 


Thanks a lot for the clarification @Trewon.
I got it now.

 

Best regards
GaSoGB


Reply