Error codes on API endpoints

Previously when an API function returned an error it responded with a (developer) friendly message saying what went wrong. This is all good but has a couple of drawbacks.

1) This was not always user friendly. A developer may not just show this error to the user since it may confuse him/her.

2) It's not easily translatable since the source text may change, breaking the app translation.

3) If the app needs to perform a specific action depending on the error it must parse the error message string. The same as number 2 above.

It has been a much requested feature to add an error code to the responses as well, so now we have done this.

An error from the API returns two codes. One generic and one specific to this error. Currently these are the generically defined:

Not found = 1
Access denied = 2
Offline = 3
Invalid argument = 4
Length = 5
Out of range = 6
Unsupported = 7
Unknown = 99

The specific error code is unique and specific to that type of error. For example, in addition to "Not found" (1) the specific code might tell the developer what resource could not be found. The specific codes are documented individually for each endpoint and can be found in the API explorer.

Not all endpoints have been updated with theses codes yet. Please see the API explorer for each endpoint. More information: https://api.telldus.com/documentation/errors

Comments

No comments.