Greetings,
I’d like to re-iterate this request and this one
I’m maintaining some code written a few years ago by someone who has left the company. The response handling code, particularly for errors, is checking the response content as well as status codes. There isn’t a great deal of documentation to explain why the logic is the way it is. I am concerned that error response content might change and the next person will encounter similar confusion. Publishing a list of error codes and messages (or a formula for the messages if there is one) would really help me out a lot
Thanks in advance
NY
1 Like
Hi NY,
Welcome to our API Forum! Thanks for posting your question.
The FreeAgent API handles error messaging through standard HTTP status codes with error messages included in the response body. Unfortunately, we cannot currently provide a list of all possible error messages. The error messaging should contain a description of the cause of the error, however, will vary depending on the endpoint in question or the nature of the error. I.e. an error from a failed validation on a resource submission will be different to that from a simply badly formatted request.
Can you give an example of the type of errors or error responses your code is checking for?
Andrew
Good afternoon Andrew.
Thank you for taking the time to reply to my query.
I appreciate the list of possible errors could be large, would have to be maintained and might bleed implementation detail. In reply to your question:
We handle a number of 422s, with the error content being quite self explanatory, for example “Invoice not found for this company”. Some I’m not sure about:
422 “Contact not found”
400 “Invalid nominal code”
403 “You are not allowed to access this action.” (Best guess is that this is related to Access Levels)
and
“API access is disabled for this company”, I’m not sure if this one is a 401 or 403.
I’m sure you’ll appreciate I’d rather avoid trying to find these by trial and error. I am working on an unrelated issue but I’d like to leave the code in a better state than I found it so many thanks in advance for any clarification you can provide.
NY