Returning multiple errors through the api
Do you have any plans to return multiple errors at once through
the API? For instance, if both the credit card number and the
expiration date are blank, right now I only get one error back,
saying the credit card number is blank.
<?xml version="1.0" encoding="UTF-8"?>
<error id="78386" code="412" auxCode="subscription[ccNumber]:isEmpty">
A value is required
</error>
I know you recognize that both are blank, because both errors show up in the error reporting web interface. It would be nice if I got back both errors through the api as well, like the following:
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error id="78386" code="412" auxCode="subscription[ccNumber]:isEmpty">
A value is required
</error>
<error id="78389" code="412" auxCode="subscription[ccExpiration]:isEmpty">
A value is required
</error>
</errors>
Thanks!
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Marc Guyer on 10 Dec, 2010 03:42 PM
This would be possible as you describe but would break backward compatibility. The API is not intended to be a complete error handler. It's best for that to occur in the client application with native validation and error handling. The API error response should just be relied upon as a "catch-all" for unexpected or rare errors.
In the future, we might introduce a new API call to retrieve detailed information on an error by ID but it's not on the current roadmap.
2 Posted by michael on 10 Dec, 2010 07:27 PM
I would actually expect exactly the opposite - that the API should be a complete error handler. I would prefer to put the minimum amount of logic possible on my side - i.e., I don't want to write complicated checks for valid credit card numbers, expiration dates, zip codes, and ccv numbers - since you have already written them and probably written them to be much more comprehensive than I can. By only returning one error at a time, you make it quite difficult to give the user of an application using your API a good user experience.
Most of your competitors return multiple errors at a time as well:
Chargify: http://docs.chargify.com/api-subscriptions
Recurly: http://docs.recurly.com/api/errors
I'm pretty sure Spreedly does as well, although I couldn't find the relevant docs.
Support Staff 3 Posted by Marc Guyer on 10 Dec, 2010 08:58 PM
Thanks Michael -- we certainly appreciate your suggestion. Unfortunately it's not possible to change the existing error return format. As I mentioned, we could develop a method to retrieve the error detail. Can you wait for it for a day or two?
4 Posted by michael on 10 Dec, 2010 10:17 PM
Take your time! I just wanted to make sure it was on your roadmap and you were aware of it (and the reasons it was desirable).
adam closed this discussion on 28 Sep, 2011 03:00 PM.