# Not able to view saved object after importing via API

**URL:** <https://discuss.elastic.co/t/not-able-to-view-saved-object-after-importing-via-api/209666>\
**Category:** Kibana\
**Created:** [November 27, 2019, 10:58am UTC](https://discuss.elastic.co/t/not-able-to-view-saved-object-after-importing-via-api/209666 "2019-11-27T10:58:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kibana-rocks](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kibana-rocks](https://discuss.elastic.co/u/kibana-rocks)\
**Post date:** [November 27, 2019, 10:58am UTC](https://discuss.elastic.co/t/not-able-to-view-saved-object-after-importing-via-api/209666/1 "2019-11-27T10:58:03Z")

</div>

Hi,

I imported multiple saved\_objects (index-pattern, visualization, dashboard) via `POST /api/saved_objects/_import` API. It gives successful response code -`200 as response code` for all saved objects.  
But when i check in Kibana, some saved objects are missing.  
Its very random and there is no fixed file which is not able to be imported.This is observed very inconsistently.  
What can be the reason for this?

I am using 7.2 version of Kibana.  
Can we please get some help here?

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [November 27, 2019, 11:52am UTC](https://discuss.elastic.co/t/not-able-to-view-saved-object-after-importing-via-api/209666/2 "2019-11-27T11:52:13Z")

</div>

Hello,

let me ask you few things to understand better the problem:

- Are you importing saved object exported via API or via GUI? (unfortunately at the moment you can only export-import using the same means, export API - import API, export GUI - import GUI)
- How did you find out that some saved\_objects are missing? some dashboard and visualization were missing or you used the saved\_object API to retrieve the available saved\_objects?

```auto
http://localhost:5672/api/kibana/management/saved_objects/_find?type=visualization&type=index-pattern&type=dashboard

```

- last question: where the saved object exported in an older version of kibana?

---

<div class="post-metadata">

**Author:** ![kibana-rocks](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kibana-rocks](https://discuss.elastic.co/u/kibana-rocks)\
**Post date:** [November 28, 2019, 7:23am UTC](https://discuss.elastic.co/t/not-able-to-view-saved-object-after-importing-via-api/209666/3 "2019-11-28T07:23:49Z")

</div>

@markov00

- I exported all the saved objects files via GUI. And then using the same `ndjson` files to import via API.  
If we can only export-import using the same means, export API - import API, export GUI - import GUI, then why major saved objects are successfully imported only few are failing?

I have around more than 100 saved object files and explicitly export individual object with API and then saving in a separate ndjson file and then import with API is a very tedious job. Is there any better way to achieve it?

- I found out some saved\_objects are missing in GUI as there is mismatch in count between the objects imported and the objects which i imported from the API.  
Even i checked with **`GET /api/saved_objects/<type>/<id>`** API to check the presence of saved object. The response was **saved object not found**

- All the exported saved objects _(.ndjson)_ files are stored in a folder. From this folder api is trying to import the files via API.

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [November 28, 2019, 9:18am UTC](https://discuss.elastic.co/t/not-able-to-view-saved-object-after-importing-via-api/209666/4 "2019-11-28T09:18:34Z")

</div>

You are right, I'm sorry, the issue I was reporting about the incompatibility of exported saved objects between API and GUI doesn't exist in the case the GUI you are referring to is the Management -\> Saved Objects (I was referring to exporting a dashboard saved object from the Dashboard UI and importing it through API). Sorry for the confusion.

> I have around more than 100 saved object files and explicitly export individual object with API and then saving in a separate ndjson file and then import with API is a very tedious job. Is there any better way to achieve it?

Sure, you can export saved object by types and you can download all types at ones with this:

> **[Export objects API | Kibana Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/kibana/current/saved-objects-api-export.html)**

```auto
POST api/saved_objects/_export
{
    "type": [
        "config",
        "map",
        "canvas-workpad",
        "canvas-element",
        "index-pattern",
        "visualization",
        "search",
        "dashboard",
        "url"
    ],
    "includeReferencesDeep": true
}

```

This will return all the saved object available in kibana (is exactly the same function called by the UI when you export all your objects.

Than you can import that using

> **[Import objects API | Kibana Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/kibana/current/saved-objects-api-import.html)**

```auto
$ curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@YOUR_EXPORTED_FILENAME.ndjson 

```

And it should import all your object.  
The response should also contains a message like the following that contains the number of imported objects, and the status of the import (together with errors if any)

```auto
{
  "success": false,
  "successCount": 1,
  "errors": [
     // list of errors
  ]

```

---

<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:** [December 26, 2019, 9:18am UTC](https://discuss.elastic.co/t/not-able-to-view-saved-object-after-importing-via-api/209666/5 "2019-12-26T09:18:36Z")

</div>

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