transformations

Embed
Preview of the card
<a href="https://lucida.15-204-158-166.sslip.io/docs/ref-transformations"><img src="https://lucida.15-204-158-166.sslip.io/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/2f7ff431-19a8-403b-b509-5d9a50011a8e/social-card.svg?v=3e7ae33eec8b" alt="transformations" width="600" height="315"></a>
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter

Parameters

project_idstringpathrequired

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "counts": {
    "dropped": 0,
    "processed": 0,
    "would_drop": 0
  },
  "failing_tests": [
    0
  ],
  "mode": "string",
  "root": {},
  "tests": [
    {}
  ]
}
Schema
countsobjectrequired
Show child parameters
droppedintegerrequired
processedintegerrequired
would_dropintegerrequired
Matched while in dry run (would have been dropped live).
failing_testsinteger[]required
Indexes of saved tests whose expectation does not hold.
modestringrequired
off | dry_run | live
rootobjectrequired
{type: and|or, children} / {type: not, child} / {type: condition, field: event|distinct_id, op: equals|contains|starts_with|ends_with|regex, value}
testsobject[]required
[{event, distinct_id, expect_drop}]
404 no filter configured
PUThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter

Parameters

project_idstringpathrequired

Request body

application/json

Up to 20 conditions, 5 levels deep, 50 test cases.

modestringrequired
off | dry_run | live; live needs every test case to pass.
rootobjectrequired
testsobject[]
{
  "mode": "string",
  "root": {},
  "tests": [
    {}
  ]
}

Code samples

cURL
curl -X PUT "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter" \
  -H "Content-Type: application/json" \
  -d '{"mode":"string","root":{},"tests":[{}]}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

400
403
404
DELETEhttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter

Parameters

project_idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204
403
404
POSThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter/test

Parameters

project_idstringpathrequired

Request body

application/json
eventsobject[]required
Events to try: [{event, distinct_id}] (at most 100).
filterFilterBody
Show child parameters
modestringrequired
off | dry_run | live; live needs every test case to pass.
rootobjectrequired
testsobject[]
{
  "events": [
    {}
  ],
  "filter": {
    "mode": "string",
    "root": {},
    "tests": [
      {}
    ]
  }
}

Code samples

cURL
curl -X POST "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/event-filter/test" \
  -H "Content-Type: application/json" \
  -d '{"events":[{}],"filter":{"mode":"string","root":{},"tests":[{}]}}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "drops": [
    true
  ],
  "failing_tests": [
    0
  ]
}
Schema
dropsboolean[]required
Per event, in order: whether the tree matches (the event would be dropped when live).
failing_testsinteger[]required
400
404
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules

Parameters

project_idstringpathrequired

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of JsRule in application order (a project has at most 20; one page)
404
POSThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules

Parameters

project_idstringpathrequired

Request body

application/json
enabledboolean
namestringrequired
positioninteger
Application order (ascending); defaults to last.
sourcestringrequired
JavaScript defining transform(event); at most 64 KiB.
{
  "enabled": true,
  "name": "string",
  "position": 0,
  "source": "string"
}

Code samples

cURL
curl -X POST "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"name":"string","position":0,"source":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201
Example
{
  "created_at": "2024-01-01T00:00:00Z",
  "enabled": true,
  "id": "string",
  "name": "string",
  "position": 0,
  "quarantine_reason": "string",
  "quarantined_until": "2024-01-01T00:00:00Z",
  "source": "string",
  "updated_at": "2024-01-01T00:00:00Z"
}
Schema
created_atstringrequired
enabledbooleanrequired
idstringrequired
namestringrequired
positionintegerrequired
quarantine_reasonstring
quarantined_untilstring
Set while the worker has the rule paused after repeated errors; it re-enables at this time.
sourcestringrequired
updated_atstringrequired
400
403
404
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv

Parameters

project_idstringpathrequired
prefixstringquery
Only keys starting with this.
limitintegerquery
cursorstringquery

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of KvRow in key order
400
404
DELETEhttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv

Delete one key, a prefix, or (no parameters) every key; admins only, audited.

Parameters

project_idstringpathrequired
keystringquery
Delete exactly this key.
prefixstringquery
Delete every key starting with this. With neither, the whole store is cleared.

Code samples

cURL
curl -X DELETE "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "deleted": 0
}
Schema
deletedintegerrequired
400
403
404
PUThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv/quota

Set the project's key-value quota; admins only. Writes past it are refused in rule code.

Parameters

project_idstringpathrequired

Request body

application/json
max_bytesintegerrequired
1024 to 67108864.
max_keysintegerrequired
1 to 100000.
{
  "max_bytes": 0,
  "max_keys": 0
}

Code samples

cURL
curl -X PUT "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv/quota" \
  -H "Content-Type: application/json" \
  -d '{"max_bytes":0,"max_keys":0}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "bytes": 0,
  "keys": 0,
  "max_bytes": 0,
  "max_keys": 0
}
Schema
bytesintegerrequired
keysintegerrequired
max_bytesintegerrequired
max_keysintegerrequired
400
403
404
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv/usage

Parameters

project_idstringpathrequired

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/kv/usage"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

404
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/metrics

Parameters

project_idstringpathrequired
hoursintegerquery

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/js_rules/metrics"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of RuleMetrics (transformation_id is the JS rule id): totals and an hourly series per rule that ran in the window (one page)
404

Updated