헬스 체크
curl --request GET \
--url https://sajuapi.dev/v1/health \
--header 'X-API-Key: <api-key>'import requests
url = "https://sajuapi.dev/v1/health"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://sajuapi.dev/v1/health', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sajuapi.dev/v1/health",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sajuapi.dev/v1/health"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sajuapi.dev/v1/health")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/health")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body시스템
헬스 체크
GET
/
v1
/
health
헬스 체크
curl --request GET \
--url https://sajuapi.dev/v1/health \
--header 'X-API-Key: <api-key>'import requests
url = "https://sajuapi.dev/v1/health"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://sajuapi.dev/v1/health', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sajuapi.dev/v1/health",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sajuapi.dev/v1/health"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sajuapi.dev/v1/health")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/health")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyv1 Enterprise API (Coming Soon)이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다.
현재는 v0 API를 사용하세요.
이 엔드포인트는 인증 없이 호출할 수 있습니다. 상세한 서비스 상태는
/v1/status 엔드포인트를 사용하세요.Response
성공
서비스가 정상이면200 OK와 함께 상태 정보가 반환됩니다.
실패
| 상태 코드 | 에러 타입 | 설명 |
|---|---|---|
| 503 | service_unavailable | 서비스를 사용할 수 없음 |
요청 예시
curl -X GET https://api.sajuapi.dev/v1/health
const response = await fetch(
'https://api.sajuapi.dev/v1/health'
);
const health = await response.json();
if (health.status === 'healthy') {
console.log('서비스 정상');
}
import requests
response = requests.get(
'https://api.sajuapi.dev/v1/health'
)
health = response.json()
print(f"Status: {health['status']}")
응답 예시
정상
{
"status": "healthy",
"timestamp": "2025-01-16T09:00:00Z"
}
비정상
{
"status": "unhealthy",
"timestamp": "2025-01-16T09:00:00Z"
}
Health 객체
| 필드 | 타입 | 설명 |
|---|---|---|
status | string | 서비스 상태입니다. healthy 또는 unhealthy입니다. |
timestamp | string | 응답 생성 시간입니다. |
활용 사례
Kubernetes Liveness Probe
livenessProbe:
httpGet:
path: /v1/health
port: 3000
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
AWS ALB Health Check
Health check path: /v1/health
Healthy threshold: 2
Unhealthy threshold: 3
Timeout: 5 seconds
Interval: 30 seconds
Success codes: 200
헬스 체크 엔드포인트는 가볍게 유지되어 빠른 응답 시간을 보장합니다. 데이터베이스 연결 상태 등 상세 정보가 필요하면
/v1/status를 사용하세요.⌘I