Forum Discussion
Hi Varun,
You should be able to get a count of messages (topics and replies together) via REST V2 if you exclude the depth parameter from your LiQL query -- a query like this should do the trick I believe:
SELECT count(*) FROM messages WHERE board.id = 'technology' AND post_time > 1454348367000 AND post_time < 1454953167993 ORDER BY post_time DESC
Probably what you are seeing with using the browser giving you no results is because we block authentication on the call (for security reasons). If you were to include a REST session key with your call in the browser, then you will most likely see the same results.
-Doug
hi DougS,
if I want to get the latest posts/or count for the last week, not specifying a week,
Is it any way to get the results?
I did try, not working:
SELECT count(*) FROM messages WHERE board.id = 'topics' AND post_time < 604800 ORDER BY post_time DESC
Any suggestions?
- DougS9 years agoKhoros Oracle
You would have to specify a timerange in the query (you need a start time and an end time). If you were coding this in an endpoint, you could generate the query you need with something like this:
<#assign now = dateSupport.now /> <#assign nowMs = now.millisecondsAsString /> <#assign weekBefore = now.addWeek(-1) /> <#assign weekBeforeMs = weekBefore.millisecondsAsString /> <#assign query = "SELECT count(*) FROM messages WHERE board.id = 'technology' AND post_time > " + weekBeforeMs + " AND post_time < " + nowMs + " ORDER BY post_time DESC" />
-Doug
Related Content
- 4 years ago
- 6 months ago
- 2 years ago