Solved

IFS Cloud22R2 - REST API Response: Error 500 Details Array

  • 12 June 2023
  • 4 replies
  • 123 views

Userlevel 3
Badge +9

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

 

icon

Best answer by Trewon 13 June 2023, 08:27

View original

4 replies

Userlevel 2
Badge +6

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

 

Userlevel 3
Badge +9

@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

Userlevel 2
Badge +6

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

 

Userlevel 3
Badge +9

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

 

Best regards
GaSoGB

Reply