본문 바로가기
Shoal
Shoal

API 레퍼런스

평가

SDK가 없는 언어나 디버깅을 위해 HTTP로 플래그를 평가합니다.

플래그 평가

POST/evaluate

API 토큰 대신 SDK 키로, 컨텍스트에 대해 플래그를 하나 이상 평가합니다. 엣지에서 약 10ms 안에 응답합니다.

헤더

Authorizationstring필수
Bearer <sdk key> — 서버 키 또는 클라이언트 키.

본문 파라미터

flagsstring[]선택
평가할 키. 생략하면 전체.
contextobject필수
평가 컨텍스트. user.id 필수.
detailboolean선택기본값: false
결과마다 이유 포함.

요청

Terminal
curl -X POST https://edge.shoal.dev/v2/evaluate \
  -H "Authorization: Bearer $SHOAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "flags": ["new-checkout"], "context": { "user": { "id": "u_42", "plan": "pro" } }, "detail": true }'
TypeScript
const res = await fetch("https://edge.shoal.dev/v2/evaluate", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.SHOAL_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ flags: ["new-checkout"], context: { user: { id: "u_42" } } }),
});
Python
import requests
requests.post("https://edge.shoal.dev/v2/evaluate",
  headers={"Authorization": f"Bearer {key}"},
  json={"flags": ["new-checkout"], "context": {"user": {"id": "u_42"}}})

응답

JSON
{
  "values": { "new-checkout": true },
  "reasons": { "new-checkout": { "kind": "RULE_MATCH", "ruleIndex": 0 } }
}
JSON
{
  "error": { "code": "invalid_context", "message": "context.user.id is required" }
}

검색어를 입력하세요. 브라우저 안의 로컬 색인에서 찾습니다.

↑ ↓ 이동↵ 열기MiniSearch · local