All invalid api calls should always show feedback when possible
chrisjsimpson opened this issue · 0 comments
Scenario
Developer using api submits a post
request to /obp/v3.1.0/banks/BANK_ID/customers
with an invalid value for kyc_status
Expected response:
When possible, the api response must inform the api user which field is invalid.
Actual response:
{"code":400,"message":"OBP-10001: Incorrect json format. The Json body should be the PostCustomerJsonV310 "}
Motivation
Developers should be able to troubleshoot api responses themselves, provided there is enough error feedback based on the structure of the data they send.
The actual repose is not helpful. Out of 22 possible data-points for this api call, the developer has no clue which properties are invalid.
Proposed solution:
use display_internal_errors
or provide api validation only errors
When we enable the props setting display_internal_errors=True
Then the error message is more useful, for example:
{"code":400,"message":"OBP-10001: Incorrect json format. The Json body should be the PostCustomerJsonV310 <- No usable value for kyc_status\nDo not know how to convert JString(TRUE) into boolean"}
Right away , as an API user, it is possible to see the error is with the kyc_status
property. The developer can now easily focus on correcting the data they are sending.
There is concern @hongwei1 that display_internal_errors
is too broad for this , as it may show internal errors which are sensitive. Therefore maybe a more granular setting is needed.