Forum Discussion

fuenteso's avatar
fuenteso
Leader
8 years ago

conversation.last_post_time not working?

Hi,

 

I'm trying to use conversation.last_post_time as a constraint in a query but I'm not getting the expected results.

 

The documentation says it can be used as I constraint: https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collection=messages#constraints

 

I want to pull a list of threads that were last active during a period of time to archive them, so I'm using this query:

 

SELECT id, board, conversation, view_href, metrics, post_time FROM messages WHERE conversation.last_post_time <= ${endDate} AND conversation.last_post_time > ${startDate} AND depth = 0 AND board.id='${board}'

 

It seems to work, but I'm doing some tests and the results are not accurate. For example

 

If I use this query:

SELECT count(*) FROM messages WHERE conversation.last_post_time <= 2011-09-18T23:59:59-07:00 AND conversation.last_post_time > 2011-09-18T00:00:00-07:00 AND depth = 0 AND board.id='ArchivesImprimantes'

 

I get zero results. Here's the screenshot of the response when using API 2.0 directly on the production community on the browser

But I know there's a thread that meet the criteria. This is the thread information I get when using the same API 2.0

 

It would seem as is the query is ALSO checking the original post date and matching it to the daterange. But I don't care about the original post date, I just need the last_post_date.

 

Can someone confirm the actual behavior of the API call? Am I not understanding the documentation?

 

Thanks!

 

 

  • Not sure it's relevant, but I had an issue with that today. Turns out I needed to use restadmin and not rest, to make the call.

    • PaoloT's avatar
      PaoloT
      Lithium Alumni (Retired)

      PerBonomi wrote:

      Not sure it's relevant, but I had an issue with that today. Turns out I needed to use restadmin and not rest, to make the call.


      Hi PerBonomi & fuenteso

       

      Please be aware that using restadmin might return also threads that are not meant to be viewed by standard users or anonymous users. Of course, that might not be the case if you are also applying other filters. If the behavior you describe is happening, it's worth raising it with Support to get it verified in QA.

       

      Thanks,

      • I am also facing similar issue. Can anyone help with the resolution for this?? Does restadmin works in this case?? What exactly is the problem with the API here ??