I'm working on implementing a client for the REST APIs using the provided Swagger specifications. One thing I'm struggling a little with is proper error handling. For cases where the API returns something other than a 200 response, I can use the response code and message details to learn more about the error, but there are some APIs that will return a 200 response and set a 'success' field to 'false', as is specified in the Responses and Errors article. This response isn't documented in the specificaitons, so the code I have generated from the Swagger specification loses the 'reasons' array. All I know is that succes = false. Are there any suggestions or best practices for handling errors in this format with clients generated from the provided Swagger specification? Here's an example call that will returnn a 200 response with success = false for the Create Payment call in the Payments API (https://www.zuora.com/developer/api-reference/#operation/POST_CreatePayment 😞 POST /v1/payments HTTP/1.1
Host: rest.apisandbox.zuora.com
apiAccessKeyid: ***
apiSecretAccessKey: ***
Content-Type: application/json
Cache-Control: no-cache
{
"accountId": "***",
"amount" : 100,
"currency" : "USD",
"effectiveDate" : "2017-06-23",
"type" : "Electronic",
"paymentMethodId" : "***",
"invoices" : [
{
"amount" : 100,
"invoiceId" :"***"
}
]
} And the example response: {
"success": false,
"processId": "9C5137166309351D",
"reasons": [
{
"code": 53810000,
"message": "gatewayId must be specified in order to create an electronic payment."
}
]
}
... View more