# Is there an API call to select dark mode for a named space?

**URL:** <https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778>\
**Category:** Kibana\
**Created:** [April 25, 2020, 5:29pm UTC](https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778 "2020-04-25T17:29:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![drjan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drjan/32/67120_2.png) [@drjan](https://discuss.elastic.co/u/drjan)\
**Post date:** [April 25, 2020, 5:29pm UTC](https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778/1 "2020-04-25T17:29:39Z")

</div>

I'd like to set the dark mode theme on a non-default Kibana Space using a curl command.

Is this possible?

For the default space, I can use the command below, but I can't find anything for specific spaces.

```auto
curl -XPUT "#{kibana_url}/api/saved_objects/config/7.1.1" -H "Content-Type: application/json" -H "kbn-xsrf: true" -d' {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
  "attributes": {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
    "theme:darkMode": true } }'

```

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [April 26, 2020, 11:39am UTC](https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778/2 "2020-04-26T11:39:15Z")

</div>

The saved object API is also available on each space:

```auto
PUT <kibana host>:<port>/s/<space_id>/api/saved_objects/<type>/<id>

```

Reference: [https://www.elastic.co/guide/en/kibana/7.6/saved-objects-api-update.html](https://www.elastic.co/guide/en/kibana/7.6/saved-objects-api-update.html)

---

<div class="post-metadata">

**Author:** ![drjan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drjan/32/67120_2.png) [@drjan](https://discuss.elastic.co/u/drjan)\
**Post date:** [April 30, 2020, 10:56am UTC](https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778/3 "2020-04-30T10:56:14Z")

</div>

Thanks, I tried that but I'm not having much luck with it 🙂

Here's my code, it sets dark mode for the default space, and then for the 'new' space:

```auto
    PUT <kibana host>:<port>/api/saved_objects/config/7.1.1 -d '
    {
      "attributes": {
        "theme:darkMode": true
      }
    }'

    PUT <kibana host>:<port>/s/new/api/saved_objects/config/7.1.1 -d'
    {
      "attributes": {
        "theme:darkMode": true
      }
    }'

```

The first part works as expected, but for the second call I get this result:  
{"statusCode":404,"error":"Not Found","message":"Saved object [config/7.1.1] not found"}

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [April 30, 2020, 12:58pm UTC](https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778/4 "2020-04-30T12:58:25Z")

</div>

I think if you have never changed the config in the separate space, the saved object won't exist (this is why updating it fails). Try creating a new config saved object instead.

---

<div class="post-metadata">

**Author:** ![drjan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drjan/32/67120_2.png) [@drjan](https://discuss.elastic.co/u/drjan)\
**Post date:** [May 7, 2020, 2:12pm UTC](https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778/5 "2020-05-07T14:12:09Z")

</div>

That has worked! 🙂

Thanks very much for your help with this 🙂

---

<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 4, 2020, 2:12pm UTC](https://discuss.elastic.co/t/is-there-an-api-call-to-select-dark-mode-for-a-named-space/229778/6 "2020-06-04T14:12:17Z")

</div>

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