Forum Discussion

aniciu's avatar
aniciu
Adept
8 years ago
Solved

Can I post a new message with a V1 API with a past message.post_time?

We are in the process of transferring our proprietary implementation of a community to Lithium and in the process, we need to copy/transfer some of the existing knowledge base articles. Is there a way to set the message.post_time in the past, so that this date reflects the date the content was originally created, not the date we moved this topic to Lithium?

  • aniciu It's not documented but yes you can post the message with original date.

    <#assign subject = "Test Article" />
    <#assign body = "Here is test article" />
    <#assign post_time = "Feb 06, 2017 06:30:40 PM" />
    <#assign post_time = post_time?datetime />
    
    <#-- Add Blog -->
    
    	<#assign addBlog = restadmin("blogs/id/reads_and_resources/messages/post?message.body=${body?url}&message.subject=${subject?url}&message.author=/users/login/John&message.post_date=${post_time?iso('UTC')}") />

7 Replies

  • aniciu It's not documented but yes you can post the message with original date.

    <#assign subject = "Test Article" />
    <#assign body = "Here is test article" />
    <#assign post_time = "Feb 06, 2017 06:30:40 PM" />
    <#assign post_time = post_time?datetime />
    
    <#-- Add Blog -->
    
    	<#assign addBlog = restadmin("blogs/id/reads_and_resources/messages/post?message.body=${body?url}&message.subject=${subject?url}&message.author=/users/login/John&message.post_date=${post_time?iso('UTC')}") />
  • aniciu's avatar
    aniciu
    Adept
    8 years ago

     

    The solution doens't work me.

    I tried to post with a past date with my curl command, but no luck.

    curl -X POST -d 'restapi.session_key=rtertretyeryetytreyrteuyre
    'https://<host>/restapi/vc/boards/id/myforum/messages/post?message_body=HowAreyou2&message.subject=Hithere2& message.post_time=2015-10-09'

     

    The message inserts well, but with the current date. What I am doing wrong?

  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    aniciu

    Try this one. Hope, would work fine with DateTime

    curl -X POST -d 'restapi.session_key=rtertretyeryetytreyrteuyre
    'https://<host>/restapi/vc/boards/id/myforum/messages/post?message_body=HowAreyou2&message.subject=Hithere2& message.post_time=2015-10-09T02:30:40Z'
  • aniciu's avatar
    aniciu
    Adept
    8 years ago

    VikasBI tried it, the response still comes back with <post_time type="date_time">2018-01-10T21:21:31+00:00</post_time> (which is right now). I also see this message  Is there some setting somewhere that I need to change? Thanks much!

  • aniciu's avatar
    aniciu
    Adept
    8 years ago

    Hi VikasB. I tried it, the response still comes back with <post_time type="date_time">2018-01-10T21:21:31+00:00</post_time> (which is right now). I also see this message  Is there some setting somewhere that I need to change? Thanks much!

  • JeffMo's avatar
    JeffMo
    Mentor
    7 years ago

    aniciu - were you ever able to figure this out using the V1 API over HTTP?  I'm getting the same result you mentioned above, both with and without URL encoding the timestamp.

    I'm definitely hoping to keep my creation timestamps intact through our migration.

  • aniciu's avatar
    aniciu
    Adept
    7 years ago
    No, unfortunatelly the V1 Api doesn’t support setting the date.