跳到主要内容

REST API

公开的 REST 接口分布在三个主机上:一个用于功能开关与消息,一个用于事件采集,一个用于会话回放。每个主机都提供自己的 OpenAPI 文档。

HostServesOpenAPI
https://api.prodantix.comFlags, messaging, GraphQLhttps://api.prodantix.com/openapi.json
https://eu.api.prodantix.comEvent ingestion (EU)https://eu.api.prodantix.com/openapi.json
https://eu.replay.prodantix.comSession replay (EU)https://eu.replay.prodantix.com/openapi.json

身份验证

每个 REST 操作都接受项目密钥作为 Bearer 令牌。项目密钥仅对单个项目有效;切勿将私密密钥放入客户端代码中。

JSON
{
  "Authorization": "Bearer <project key>"
}

Operations

MethodPathPurpose
GET/v1/flagsEvaluate every flag for a distinct id
GET/v1/flags/snapshotFetch the project's full ruleset for local evaluation
GET/v1/messagesRead a user's in-app inbox
POST/v1/messages/readMark an in-app message read
POST/v1/eventsIngest a batch of events
POST/v1/identifyIdentify a user and set traits
POST/v1/groupAssociate a user with a group
POST/v1/replayUpload 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"

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}}]}'

已接受不等于已持久化

采集类操作返回 202。这表示事件已被接受以待处理,而非已经持久化。格式错误的事件可能在后续处理中被丢弃。

OpenAPI 文档

每个主机在 /openapi.json 提供各自的操作。合并后的视图见本站的 API 参考页面。