# Object creation at runtime

**URL:** https://discuss.elastic.co/t/object-creation-at-runtime/103603
**Category:** Kibana
**Created:** [October 11, 2017, 7:16pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603 "2017-10-11T19:16:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![havidarou](https://avatars.discourse-cdn.com/v4/letter/h/3ec8ea/32.png) [@havidarou](https://discuss.elastic.co/u/havidarou)
#### Post date: [October 11, 2017, 7:16pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603/1 "2017-10-11T19:16:30Z")

</div>

Hi, I am developing an app type plugin.

I'd like to create objects by code.

You use request to /api/saved\_objects/type to create them, but I am worry it won't work if I use these request directly in case x-pack is installed, so I've searched further down the code.

And saw you use "kibana/src/ui/public/saved\_objects/saved\_objects\_client.js" internally to do this.

What and how should I include to use this in my app?

Thanks!

---

<div class="post-metadata">

### Author: ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)
#### Post date: [October 12, 2017, 2:18pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603/2 "2017-10-12T14:18:58Z")

</div>

Can you give some more information on the type of objects you're wanting to create?

---

<div class="post-metadata">

### Author: ![havidarou](https://avatars.discourse-cdn.com/v4/letter/h/3ec8ea/32.png) [@havidarou](https://discuss.elastic.co/u/havidarou)
#### Post date: [October 12, 2017, 4:45pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603/3 "2017-10-12T16:45:50Z")

</div>

I want to create visualizations, searches and dashboards.

I was already doing this by sending a standard request to elasticsearch, but since Kibana 6.0.0 uses an internal ID, I can't do that, so I ended up doing what I said in the first post.

Regards.

---

<div class="post-metadata">

### Author: ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)
#### Post date: [October 12, 2017, 4:52pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603/4 "2017-10-12T16:52:47Z")

</div>

As of 5.6, there is a SavedObject REST API which there are also clients for.

There is some information in this [comment here](https://github.com/elastic/kibana/pull/12648#issuecomment-313137183) on how to use the REST API.

The route definitions are located [here](https://github.com/elastic/kibana/tree/master/src/server/saved_objects/routes)

If you want to use the client, the server-side client is located [here](https://github.com/elastic/kibana/blob/master/src/server/saved_objects/client/saved_objects_client.js), and the browser-side client is what you previously pointed to.

---

<div class="post-metadata">

### Author: ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)
#### Post date: [October 12, 2017, 4:54pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603/5 "2017-10-12T16:54:33Z")

</div>

One thing to note, in addition to using unique ID's, in 6.0 (and in 5.6 after a [migration](https://www.elastic.co/guide/en/kibana/6.0/migrating-6.0-index.html)) we no longer use types in Elasticsearch.

---

<div class="post-metadata">

### Author: ![havidarou](https://avatars.discourse-cdn.com/v4/letter/h/3ec8ea/32.png) [@havidarou](https://discuss.elastic.co/u/havidarou)
#### Post date: [October 15, 2017, 5:31pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603/6 "2017-10-15T17:31:25Z")

</div>

I was wondering, what about x-pack, can we use this REST API without the credentials? And, if we indeed need them...how can we retrieve them in code?

Regards.

---

<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: [November 12, 2017, 5:31pm UTC](https://discuss.elastic.co/t/object-creation-at-runtime/103603/7 "2017-11-12T17:31:34Z")

</div>

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