Question

API error/success messages translation

Posted July 17, 2014 2.3k views

Hi!

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

{
“status”:“ERROR”,
“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.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
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.

Submit an Answer