Fragment

API

Sending events

The same as Segment's HTTP API. Send your write key as the Basic auth username, or as writeKey in the body. It answers 200 unless the body isn't JSON or is too big, so a tracking call can't break your site. An event can be 32 KB, and a batch 500 KB and 2,500 events.

curl https://harrowsoft.com/fragment/v1/track -u WRITE_KEY: -H "content-type: application/json" \
  -d '{"userId": "u1", "event": "Signed Up", "properties": {"plan": "Pro"}}'
POST /fragment/v1/trackuserId or anonymousId, event, properties.
POST /fragment/v1/identifyuserId or anonymousId, traits.
POST /fragment/v1/pageuserId or anonymousId, name, properties.
POST /fragment/v1/screenThe same, for apps.
POST /fragment/v1/groupgroupId, traits.
POST /fragment/v1/aliaspreviousId, userId.
POST /fragment/v1/batchbatch: a list of the above, each with a type.

Managing it from a script

Make a token on your tokens page, and send it as Authorization: Bearer hs_.... It can do what you can, no more.

GET /overviewThe last 24 hours, sources and destinations.
GET /sourcesYour sources and their write keys.
POST /sourcesname.
GET /destinationsYour destinations. Secrets never come back.
POST /destinationskind, name, config.
GET /destination/{id}One, with its recent failures.
PATCH /destination/{id}name, config, on, filter.
POST /destination/{id}/testSends one test event, and says what the tool said.
POST /destination/{id}/replaydays: send the last few days again.
GET /events/listNewest first. q finds an ID or event name, only_failed=true narrows it.
GET /event/{id}The trace: what came in, what each tool was sent and what it said.
GET /schemaEvery event, its fields and anything strange.
POST /schema/plantype, name, planned; or all, planned.
GET /peopleq finds an ID or trait.
GET /person/{id}Their IDs, traits and timeline.
POST /import/segmenttoken. Admins only.