-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Version:
- listmonk: v5.1.0
- OS: Docker on dokploy
GET /api/campaigns — query parameter is executed as tsquery instead of SQL
Using the query parameter on GET /api/campaigns does not behave as documented.
The documentation states that query should accept a SQL expression (similar to the subscribers endpoint), but on my instance the value is interpreted as a tsquery full-text expression instead.
Example request
GET /api/campaigns?query=campaigns.uuid = '259c94b2-5568-4a61-a37a-9f240b3a621a'&per_page=all
Actual response
500 - pq: syntax error in tsquery: "%campaigns.uuid&=&'259c94b2-5568-4a61-a37a-9f240b3a621a'%"
This shows the string is being rewritten into a tsquery ("%campaigns.uuid&=&'…'%") instead of being used as a SQL WHERE fragment.
Difference to subscribers endpoint
The subscribers endpoint does correctly treat query= as SQL, e.g.:
GET /api/subscribers?query=subscribers.name LIKE 'Test%' AND subscribers.attribs->>'city' = 'Bengaluru'
This works as expected.
Expected behaviour
GET /api/campaignsshould accept SQL expressions in thequeryparameter, consistent with the documentation and with the subscribers API.
Actual behaviour
- Listmonk interprets
queryas a tsquery string, producing syntax errors when valid SQL is provided. - Filtering on fields like
campaigns.uuidbecomes impossible.
Would be great to know whether this is a bug, a regression, or an intended change in newer versions.
Or is there another way to query campaigns by uuid?