API error/success messages translation

July 17, 2014 789 views


As an example, here it is a real response provided by the DO API:

"error_message":"Droplet is currently on. Please power it off to run this event.",
"message":"Droplet is currently on. Please power it off to run this event."

My question is... How can I know in advance all of the possible error/success messages so I can translate them on the fly?

I cannot figure out how to force all of the error/success messages, and think it does not seem an elegant approach to go.

There is no information at all regarding this issue either in the API documentation or the community forum.

Please, note I cannot make use of the API response header status. If that were the case, then I would know everything went ok when getting a 200 and wrong in case I do not get a 200.

To make it clearer, I am not interacting with the API directly. All I get is a the API "error_message" string because theses responses are provided to me by a WHMCS addon.

Thanks you very much in advance for your assistance.

1 Answer

Unfortunately there is no additional documentation for API v1. I would suggest contacting the author of the WHMCS addon and seeing if it's possible to modify the code to return the HTTP status in addition to the error message.

Have another answer? Share your knowledge.