Palbase IAP · API
/iap/placements/{placement}/rulesReplace a placement's rules
Replaces a placement's rules, all of them, in the order they are to be read: the first in effect whose conditions all hold for a viewer shows its target — a published paywall, or the variant of the experiment running on the placement for the rules —, after an experiment running for the whole placement and before the placement's default. At most 50 rules of at most 10 conditions. If-Match names the revision they were edited from: of two people editing at once, the second is told (412 rules_changed), not overwritten. Targeting picks what to show; it is not access control: the storefront, the attributes and the versions are what the client says of itself — no price or region entitlement may hang on them.
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
If-Matchstring · requiredThe rules' revision they were read at, as their ETag names it.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
rulesobject[] · requiredcurl -X PUT "https://<your-ref>.palbase.studio/iap/placements/<placement>/rules" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"rules":[{"name":"string","state":"live","target":{"experiment_id":"00000000-0000-0000-0000-000000000000","paywall_id":"00000000-0000-0000-0000-000000000000"}}]}'Responses
200The rules, saved
400The request is malformed, or a field breaks a rule (the error names which)
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)
412The rules changed since they were read (`rules_changed`): read them again and apply the edit to the new revision
413The request body is too large (`request_too_large`)
422The rules break a rule (`invalid_rules`, with every problem); nothing was saved. Or the Idempotency-Key was sent with a different request (`idempotency_key_reused`)
428No If-Match (`if_match_required`)
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 SetPlacementRules of iap's contract.