Filter messages with APIv2 and exclude multiple boards
Hi,
I just try to get the latest messages in the whole community but exclude some specific boards. Is there a way to handle this via API?
According to the Docs at https://devdocportal.lithium.com/t5/Community-API-v2-Reference/bd-p/restv2docs?section=commv2&collection=messages#constraints
I had the following ideas:
1. exclude one or more whole categories = not possible on message object via api
2. exclude multiple boards with NOT IN (...) = not possible via api, it just supports IN, = and !=
3. so i tried a chained 'and board.id !=...' with a querystring looking like this:
SELECT * FROM messages WHERE board.id != 'a' AND board.id != 'b' AND board.id != 'c' AND board.id != 'd' ORDER BY post_time
The result is, that just board.id 'a' is excluded, the others are just ignored in the query and the result contains them.
The ultimate solution would be to move these boards outside and next to our community base node and filter just for the remaining community node. But this implies some more work.
The question here is just if its possible via API for a faster temporary solution.
Thanks in advance
Marcus
For board.id != operator only support one time in the constraints at the moment and not worked with multiple != for same constraints.
To achieve this you need some more coding knowledge.
I would suggest firstly get all the boards from that category and match the board id which you don't want to include for results and create the collection of these boards with comma separated('wireless', 'routers').
Pass this collection to query with IN operator for board.id like below:
SELECT id FROM messages WHERE board.id IN ('wireless', 'routers')