# Create saved\_objects API does not import time attributes

**URL:** <https://discuss.elastic.co/t/create-saved-objects-api-does-not-import-time-attributes/183189>\
**Category:** Kibana\
**Created:** [May 28, 2019, 8:30pm UTC](https://discuss.elastic.co/t/create-saved-objects-api-does-not-import-time-attributes/183189 "2019-05-28T20:30:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lannie\_Rose](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lannie_rose/32/45843_2.png) [@Lannie\_Rose](https://discuss.elastic.co/u/Lannie_Rose)\
**Post date:** [May 28, 2019, 8:30pm UTC](https://discuss.elastic.co/t/create-saved-objects-api-does-not-import-time-attributes/183189/1 "2019-05-28T20:30:06Z")

</div>

When I create a saved\_object (dashboard) using the API, the 4 time attributes (timeRestore, timeTo, timeFrom, refreshInterval) are not created. But if I import the exact same object using the Saved Objects page of the Kibana UI, they are created. Here is the dashboard object:  
`[{ "_id": "metricbeat-system-host-overview", "_type": "dashboard", "_source": { "title": "[Metricbeat System] Host overview", "hits": 0, "description": "Overview of host metrics", "panelsJSON": "[<omitted>]", "optionsJSON": "{\"darkTheme\":false}", "version": 1, "timeRestore": true, "timeTo": "now", "timeFrom": "now-15m", "refreshInterval": { "pause": false, "value": 10000 }, "kibanaSavedObjectMeta": { "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"version\":true,\"highlightAll\":true}" } }, "_migrationVersion": { "dashboard": "7.0.0" }, "_references": [<omitted>] } ]`

Here is the API curl command, which is issued through shellExec() in my app:

`curl -f -k -X POST -H 'kbn-xsrf:true' -H 'Content-type:application/json' -d '{ "attributes": ${JSON.stringify(item._source)}, "references": ${JSON.stringify(item._references)} }' "${KIBANA_ADDRESS}/api/saved_objects/${item._type}/${item._id}?overwrite=true"`

Everything is created nicely except nothing for those 4 time attributes. Am I doing something wrong, or is this a Kibana bug?

I am using the grafana/grafana docker (and the elasticsearch docker) v7.1.0.

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [May 29, 2019, 10:48am UTC](https://discuss.elastic.co/t/create-saved-objects-api-does-not-import-time-attributes/183189/2 "2019-05-29T10:48:25Z")

</div>

Hey @Lannie_Rose,

I ran the following commands against my 7.1 installation, but I wasn't able to reproduce. The time attributes were saved along with the rest of the dashboard.

```auto
curl -XPOST http://localhost:5601/api/saved_objects/dashboard/test-object -H "kbn-xsrf: true" -H "content-type: application/json" -d '{"references": [], "attributes": {"title": "[Metricbeat System] Host overview", "hits": 0, "description": "Overview of host metrics", "panelsJSON": "[]", "optionsJSON": "{\"darkTheme\":false}", "version": 1, "timeRestore": true, "timeTo": "now", "timeFrom": "now-15m", "refreshInterval": { "pause": false, "value": 10000 }, "kibanaSavedObjectMeta": { "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"version\":true,\"highlightAll\":true}" }} }'

```

```auto
curl http://localhost:5601/api/saved_objects/dashboard/test-object -H "kbn-xsrf: true" -H "content-type: application/json"

{
  "id": "test-object",
  "type": "dashboard",
  "updated_at": "2019-05-29T10:40:08.451Z",
  "version": "WzQsMV0=",
  "attributes": {
    "title": "[Metricbeat System] Host overview",
    "hits": 0,
    "description": "Overview of host metrics",
    "panelsJSON": "[]",
    "optionsJSON": "{\"darkTheme\":false}",
    "version": 1,
    "timeRestore": true,
    "timeTo": "now",
    "timeFrom": "now-15m",
    "refreshInterval": {
      "pause": false,
      "value": 10000
    },
    "kibanaSavedObjectMeta": {
      "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"version\":true,\"highlightAll\":true}"
    }
  },
  "references": [],
  "migrationVersion": {
    "dashboard": "7.0.0"
  }
}

```

Looking at the underlying code that powers the API, I'm not seeing anything in there that would conditionally alter your input either.

---

<div class="post-metadata">

**Author:** ![Lannie\_Rose](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lannie_rose/32/45843_2.png) [@Lannie\_Rose](https://discuss.elastic.co/u/Lannie_Rose)\
**Post date:** [May 29, 2019, 5:11pm UTC](https://discuss.elastic.co/t/create-saved-objects-api-does-not-import-time-attributes/183189/3 "2019-05-29T17:11:39Z")

</div>

Hey thanks. Today mine is working, for some reason, though i didn't change anything as far as I can tell. I must have missed a build step somewhere. Sorry for the false alarum.

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [May 29, 2019, 5:32pm UTC](https://discuss.elastic.co/t/create-saved-objects-api-does-not-import-time-attributes/183189/4 "2019-05-29T17:32:17Z")

</div>

Those are the worst kinds of problems! No worries, we're here to help

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 26, 2019, 5:32pm UTC](https://discuss.elastic.co/t/create-saved-objects-api-does-not-import-time-attributes/183189/5 "2019-06-26T17:32:26Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
