palbaseDocs

Palbase IAP · API

POST/iap/placements/{placement}/resolve-preview

Preview what a placement shows a viewer

What the placement shows a viewer, and why: the experiment running for the whole placement, the rule that decided, or the default — with what every rule came to, condition by condition. The console's live preview: by the saved rules, or by rules being edited (rules), at a moment (at). Nothing is counted or changed.

Called by your server, with the project's secret key.

Path

placementstring · requiredThe placement's key: the place in the app a paywall is shown, as the app names it.

Headers

Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.

Request body

atstring (date-time) · optionalThe moment (UTC): a scheduled rule's start, an end.
contextobject · requiredA viewer to try: what its app would send, and who it is. user_id's entitlements and first seen are read from the project, unless entitlements and first_seen_days are given; user_id, else installation_id, is the subject an experiment's variant is drawn for.
rulesobject[] · optionalRules not yet saved, to try instead of the placement's.
curl
curl -X POST "https://<your-ref>.palbase.studio/iap/placements/<placement>/resolve-preview" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"context":{"app":"00000000-0000-0000-0000-000000000000","app_version":"string","attributes":{},"country":"string","entitlements":["string"],"first_seen_days":0,"installation_id":"string","locale":"string","platform":"string","sdk":"string","sdk_version":"string","user_id":"string"}}'

Responses

200What it shows

400Something of the viewer is not what it is (`invalid_context`); or the body is malformed

401No key, not a key of this project, or a token that is not valid (the edge's answer)

403Not the project's secret key (`secret_key_required`)

404No such placement (`placement_not_found`)

409A request with this Idempotency-Key is still running (`idempotency_key_in_use`, Retry-After)

413The request body is too large (`request_too_large`)

422The rules being tried break a rule (`invalid_rules`, with every problem). Or the Idempotency-Key was sent with a different request (`idempotency_key_reused`)

429Over the project's request limit; Retry-After says when to try again

503Temporarily unavailable; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation PreviewPlacement of iap's contract.