REST API
공개 REST 표면은 세 개의 호스트에 걸쳐 있습니다. 플래그와 메시징용, 이벤트 수집용, 세션 리플레이용입니다. 각 호스트는 자체 OpenAPI 문서를 제공합니다.
| Host | Serves | OpenAPI |
|---|---|---|
| https://api.prodantix.com | Flags, messaging, GraphQL | https://api.prodantix.com/openapi.json |
| https://eu.api.prodantix.com | Event ingestion (EU) | https://eu.api.prodantix.com/openapi.json |
| https://eu.replay.prodantix.com | Session replay (EU) | https://eu.replay.prodantix.com/openapi.json |
인증
모든 REST 오퍼레이션은 프로젝트 키를 Bearer 토큰으로 받습니다. 프로젝트 키는 단일 프로젝트로 범위가 제한됩니다. 비밀 키를 클라이언트 측 코드에 두지 마십시오.
JSON
{
"Authorization": "Bearer <project key>"
}Operations
| Method | Path | Purpose |
|---|---|---|
| GET | /v1/flags | Evaluate every flag for a distinct id |
| GET | /v1/flags/snapshot | Fetch the project's full ruleset for local evaluation |
| GET | /v1/messages | Read a user's in-app inbox |
| POST | /v1/messages/read | Mark an in-app message read |
| POST | /v1/events | Ingest a batch of events |
| POST | /v1/identify | Identify a user and set traits |
| POST | /v1/group | Associate a user with a group |
| POST | /v1/replay | Upload a session replay chunk |
Evaluate flags for a user
curl "https://api.prodantix.com/v1/flags?distinct_id=u_8f3a" \
-H "Authorization: Bearer $PRODANTIX_KEY"const response = await fetch('https://api.prodantix.com/v1/flags?distinct_id=u_8f3a', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const flags = await response.json();final response = await http.get(
Uri.parse('https://api.prodantix.com/v1/flags?distinct_id=u_8f3a'),
headers: {'Authorization': 'Bearer $apiKey'},
);response = requests.get(
"https://api.prodantix.com/v1/flags",
params={"distinct_id": "u_8f3a"},
headers={"Authorization": f"Bearer {api_key}"},
)Ingest an event
curl -X POST "https://eu.api.prodantix.com/v1/events" \
-H "Authorization: Bearer $PRODANTIX_KEY" \
-H "Content-Type: application/json" \
-d '{"batch":[{"distinct_id":"u_8f3a","name":"order.completed","properties":{"amount":4200}}]}'await fetch('https://eu.api.prodantix.com/v1/events', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
batch: [{ distinct_id: 'u_8f3a', name: 'order.completed' }],
}),
});final response = await http.post(
Uri.parse('https://eu.api.prodantix.com/v1/events'),
headers: {
'Authorization': 'Bearer $apiKey',
'Content-Type': 'application/json',
},
body: jsonEncode({
'batch': [
{'distinct_id': 'u_8f3a', 'name': 'order.completed'}
]
}),
);response = requests.post(
"https://eu.api.prodantix.com/v1/events",
headers={"Authorization": f"Bearer {api_key}"},
json={"batch": [{"distinct_id": "u_8f3a", "name": "order.completed"}]},
)수락은 저장을 뜻하지 않습니다
수집 오퍼레이션은 202를 반환합니다. 이는 이벤트가 처리를 위해 수락되었다는 뜻이지 저장되었다는 뜻이 아닙니다. 형식이 잘못된 이벤트는 이후 파이프라인에서 폐기될 수 있습니다.
OpenAPI 문서
각 호스트는 자체 오퍼레이션을 /openapi.json에서 제공합니다. 통합된 보기는 이 사이트의 API 레퍼런스 페이지입니다.