Forum Discussion

bhupen's avatar
bhupen
Advisor
10 years ago

how to get post_time?

Hi guyz,

I have got post title and author login but Iam not able to get the post time. Can any body help me in this:

following is the api i used:

http://community.lithium.com/restapi/vc/search/messages?q=is_root:true&sort_by=-replies

<#list messages.data.items as recent >

I used title using this syntax:  ${recent.subject}

Author:${recent.author.login}

</#list>

 

but when I am trying to get post date at this way : ${post_time} its giving me error that "Can't convert the date to string, because it's not known which parts of the date variable are in use.

 

Thanks

  • bhupen 

     

    You're developing lots of widgets !

    Try this one, worked for me:

     

    <div class="recent_digital_platform">
    <h3>Trending Topics</h3>
    <#setting locale="en_US">
    <#assign messages = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE replies.count(*)>0 AND depth=0 order by replies.count(*) desc LIMIT 3"?url) />
    <#if messages.data.items??>
      <#list messages.data.items as recent >
        <#if recent?has_content>
          <a href="${recent.view_href}">${recent.subject}</a>
          <span>${recent.author.login}</span>
          <span>${recent.post_time?datetime}</span>
          <br/>
        <#else>
          No post Trending Topics found.
        </#if>
      </#list>
    </#if>
    </div>

     

    2015-02-06_0923.png

    • bhupen's avatar
      bhupen
      Advisor

      VarunGrazitti  Thanks for reply

      following is the code. Iam using API V2:

      <div class="recent_digital_platform">
      <h3>Trending Topics</h3>
      <#setting locale="en_US">
      <#assign messages = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE replies.count(*)>0 AND depth=0 order by replies.count(*) desc LIMIT 3"?url) />

          <#if messages.data.items?datetime>                
              <#list messages.data.items as recent >
                  <#if recent?has_content>
              <a href="${recent.view_href}">${recent.subject}</a>
          <span>${recent.author.login}</span>
          <br/>
          <#else>
          No post Trending Topics found.
      </#if>
      </#list>
      </#if>
      </div>

      • OlivierS's avatar
        OlivierS
        Lithium Alumni (Retired)

        bhupen 

         

        You're developing lots of widgets !

        Try this one, worked for me:

         

        <div class="recent_digital_platform">
        <h3>Trending Topics</h3>
        <#setting locale="en_US">
        <#assign messages = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE replies.count(*)>0 AND depth=0 order by replies.count(*) desc LIMIT 3"?url) />
        <#if messages.data.items??>
          <#list messages.data.items as recent >
            <#if recent?has_content>
              <a href="${recent.view_href}">${recent.subject}</a>
              <span>${recent.author.login}</span>
              <span>${recent.post_time?datetime}</span>
              <br/>
            <#else>
              No post Trending Topics found.
            </#if>
          </#list>
        </#if>
        </div>

         

        2015-02-06_0923.png