Lewati ke konten utama

REST API

Permukaan REST publik mencakup tiga host: satu untuk flag dan pesan, satu untuk ingesti peristiwa, dan satu untuk pemutaran ulang sesi. Masing-masing menyajikan dokumen OpenAPI-nya sendiri.

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

Autentikasi

Setiap operasi REST menerima kunci proyek sebagai token Bearer. Kunci proyek terbatas pada satu proyek; jangan pernah menaruh kunci rahasia di kode sisi klien.

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

Diterima bukan berarti tersimpan

Operasi ingesti menjawab 202. Artinya peristiwa diterima untuk diproses, bukan bahwa ia tersimpan. Peristiwa yang salah bentuk masih bisa dibuang di tahap berikutnya.

Dokumen OpenAPI

Setiap host menyajikan operasinya sendiri di /openapi.json. Tampilan gabungannya adalah halaman referensi API di situs ini.