REST API
ApiFunction serves a flask-restx API plus a few plain Flask views. The current contract is the set of
endpoints listed below; the flask-restx Swagger document and UI are disabled.
Base URLs
| Environment | Base URL |
|---|---|
Production (custom domain) |
|
Production (direct) |
|
Staging |
|
Routes live under API_BASE_PREFIX (/eventlogger_v2 in production, empty in staging). /track and
/tracking/… are also served without the prefix, for the track and tracking base paths on
api.payability.com that older clients use. RulesApiId is a stack output.
Authentication
Every method of RulesApi goes through PayabilityAPIGatewayAuthorizer first, the same Lambda request
authorizer (pyb-api-gateway-authorizer:live) the Zappa API used. It is keyed on the Host header and
caches its decision for an hour. The deployed version allows every request, so today it changes nothing;
it is there so the API picks up any rule added to it later.
Authentication of the caller comes from pyb-flask-utils and differs per endpoint group:
| Endpoints | Authentication |
|---|---|
flask-restx namespaces (rules, templates, history, constants, simulate, trigger, events) |
|
|
Instance authentication ( |
|
RSA-signed JWT ( |
|
None: used by the JavaScript SDK’s tracking pixel |
Endpoints
| Path (under the base URL) | Methods | Purpose |
|---|---|---|
|
GET, POST |
List and create rules (at most |
|
GET, PUT, PATCH, DELETE |
Read, replace, update or delete a rule |
|
GET, POST |
List and create action templates |
|
GET, PUT, DELETE |
Read, replace or delete an action template |
|
GET |
Executions of one rule |
|
GET |
Executions for one target (for example a supplier) |
|
GET |
Selectors, operators, actions and statuses for the CRM rule editor |
|
POST |
Evaluate filters or rules against a sample event, without running actions |
|
POST |
Run the rules for an event now, including their actions |
|
POST |
Event search; answers 503 while search is disabled |
|
GET, POST |
Capture an event (stage 0) |
|
POST |
Capture a tracking event (stage 0) |
|
GET |
Tracking data and first contact for a target or owner |
|
GET, POST, PUT |
Search passthrough and object changelog |
|
|