<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can I set KV store collection data for data type time, when using the REST API? in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-set-KV-store-collection-data-for-data-type-time-when/m-p/260739#M2305</link>
    <description>&lt;P&gt;I am having trouble setting the value of a KV Store collection field of type time. Does anyone know the best way to do this through the REST API?&lt;/P&gt;

&lt;P&gt;Some additional detail, &lt;/P&gt;

&lt;P&gt;I have a KV Store collection, created through the REST API, which contains the following fields, with these types.&lt;/P&gt;

&lt;P&gt;&amp;lt;s:key name="field.customerId"&amp;gt;string&amp;lt;/s:key&amp;gt;&lt;BR /&gt;
&amp;lt;s:key name="field.notes"&amp;gt;string&amp;lt;/s:key&amp;gt;&lt;BR /&gt;
&amp;lt;s:key name="field.expiration"&amp;gt;time&amp;lt;/s:key&amp;gt;&lt;/P&gt;

&lt;P&gt;Next, I do a POST to my collection, with the following data:&lt;BR /&gt;
{&lt;BR /&gt;
    "customerId":"123456",&lt;BR /&gt;
    "notes":"Expiration date should be 6/1/2016",&lt;BR /&gt;
        "expiration":"2016-06-01T12:00:00.000Z"&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;Last, I check the contents of the record:&lt;BR /&gt;
{&lt;BR /&gt;
    "customerId": "123456",&lt;BR /&gt;
    "notes": "Expiration date should be 6/1/2016"&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;For some reason my expiration field won't persist data. I have taken a few guesses at the format required for my time field in the POST above, but have not had any success storing a value.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2016 22:16:03 GMT</pubDate>
    <dc:creator>danrb1978</dc:creator>
    <dc:date>2016-03-23T22:16:03Z</dc:date>
    <item>
      <title>How can I set KV store collection data for data type time, when using the REST API?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-set-KV-store-collection-data-for-data-type-time-when/m-p/260739#M2305</link>
      <description>&lt;P&gt;I am having trouble setting the value of a KV Store collection field of type time. Does anyone know the best way to do this through the REST API?&lt;/P&gt;

&lt;P&gt;Some additional detail, &lt;/P&gt;

&lt;P&gt;I have a KV Store collection, created through the REST API, which contains the following fields, with these types.&lt;/P&gt;

&lt;P&gt;&amp;lt;s:key name="field.customerId"&amp;gt;string&amp;lt;/s:key&amp;gt;&lt;BR /&gt;
&amp;lt;s:key name="field.notes"&amp;gt;string&amp;lt;/s:key&amp;gt;&lt;BR /&gt;
&amp;lt;s:key name="field.expiration"&amp;gt;time&amp;lt;/s:key&amp;gt;&lt;/P&gt;

&lt;P&gt;Next, I do a POST to my collection, with the following data:&lt;BR /&gt;
{&lt;BR /&gt;
    "customerId":"123456",&lt;BR /&gt;
    "notes":"Expiration date should be 6/1/2016",&lt;BR /&gt;
        "expiration":"2016-06-01T12:00:00.000Z"&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;Last, I check the contents of the record:&lt;BR /&gt;
{&lt;BR /&gt;
    "customerId": "123456",&lt;BR /&gt;
    "notes": "Expiration date should be 6/1/2016"&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;For some reason my expiration field won't persist data. I have taken a few guesses at the format required for my time field in the POST above, but have not had any success storing a value.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 22:16:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-set-KV-store-collection-data-for-data-type-time-when/m-p/260739#M2305</guid>
      <dc:creator>danrb1978</dc:creator>
      <dc:date>2016-03-23T22:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set KV store collection data for data type time, when using the REST API?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-set-KV-store-collection-data-for-data-type-time-when/m-p/260740#M2306</link>
      <description>&lt;P&gt;You need to use a valid BSON data type and 'time' is not valid. Have a look at these two and see if either work.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.mongodb.org/manual/reference/bson-types/#date"&gt;https://docs.mongodb.org/manual/reference/bson-types/#date&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.mongodb.org/manual/reference/bson-types/#timestamps"&gt;https://docs.mongodb.org/manual/reference/bson-types/#timestamps&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I believe you'll need to convert your date to epoch time as well.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval epoch=strptime(expiration, "%Y-%m-%dT%H:%M:%S.%3NZ")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 17:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-set-KV-store-collection-data-for-data-type-time-when/m-p/260740#M2306</guid>
      <dc:creator>shaskell_splunk</dc:creator>
      <dc:date>2016-04-28T17:16:12Z</dc:date>
    </item>
  </channel>
</rss>

