Chuyển đến nội dung chính

REST API

Bề mặt REST công khai trải trên ba máy chủ: một cho cờ tính năng và tin nhắn, một cho thu nhận sự kiện, và một cho phát lại phiên. Mỗi máy chủ phục vụ tài liệu OpenAPI riêng.

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

Xác thực

Mọi thao tác REST nhận khóa dự án dưới dạng token Bearer. Khóa dự án chỉ áp dụng cho một dự án; đừng bao giờ đặt khóa bí mật trong mã phía máy khách.

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

Được chấp nhận không có nghĩa là đã lưu

Các thao tác thu nhận trả về 202. Điều đó nghĩa là sự kiện đã được chấp nhận để xử lý, không phải đã được lưu. Một sự kiện sai định dạng vẫn có thể bị loại bỏ ở giai đoạn sau.

Tài liệu OpenAPI

Mỗi máy chủ phục vụ các thao tác riêng tại /openapi.json. Chế độ xem hợp nhất là trang tham chiếu API trên trang này.