Reputation: 1538
DISCLAIMER: At first, It seemed to me like this is too simple question to ask, however I couldn't find any definitive answer and there is a chance the answer is out there in a community but not documented because it's too simple :}
The questions are:
(canonical in a sense most tools and platforms recognize it and support it natively)
Upvotes: 0
Views: 140
Reputation: 8676
It is up to REST service developer how to implement health-check of their service. The main reason is that REST service is implementing certain business logic and different logic has different "attributes" of how healthy a service is.
Regarding encoding health information, the normal way is to provide response status code which is considered problematic if response is a kind of 5xx, which means that server failed to fulfill the request.
Codes like 4xx cannot be considered for healthchecking hence they rather mean that problem was caused by the client.
Alongside with status code they often supply error details in response body. Like:
{status: "ERROR", description: "Here is error description"}
P.S. - Some implementations extend the code range and introduce their own which are to be treated in a special way that is implied by service developers.
Upvotes: 1