Forum Discussion

arthur_'s avatar
arthur_
Guide
7 years ago

Get post_time through API v2

Hi,

 

We are trying to get date when post was created using query similar to one below:

 

SELECT conversation.last_post_time, current_revision.last_edit_time, post_time FROM messages WHERE board.id ='board_ID' ORDER BY post_time DESC

 

Unfortunately when dates are pulled from API, none of them (last_post_time, last_edit_time and post_time) matches post date that is shown next to the post in the native component. There are no other time related fields in message object.

 

Does post date is stored somewhere else or there might be inconsistencies/issues with the service?

 

Thank you very much for your advice!

  • arthur_

    It seems there is some misunderstanding or it may be your instance-specific issue. Every message will return there own post time.  See here https://prnt.sc/iq7b9r

    If you want to get the only main topic then you have to pass the depth but it does not mean by passing the depth it returns the right time.

    select id, depth,post_time from messages where depth = 0 order by post_time desc
  • arthur_

    Post_time would work here. 

    select subject,post_time from messages order by post_time desc

    I posted the message right now(20:20 IST) but returns me (7:50 PDT). So it would not return your local time.

    • arthur_'s avatar
      arthur_
      Guide

      VikasB

       

      Thank you for the prompt reply.

       

      The problem is that post_date does not contain the time when post itself was created, but it returns the date of the last comment.

      • VikasB's avatar
        VikasB
        Boss

        arthur_

        FYI it would not return the post_time in your local time. It would return the Pacific time (server time). I posted the message and then posted a reply on it. It returns the right post time. 

        See here https://prnt.sc/iq5gpz