# How to get settings in widgets api implementation

**URL:** <https://community.homey.app/t/how-to-get-settings-in-widgets-api-implementation/119381>\
**Category:** Developers\
**Created:** [October 30, 2024, 9:02pm UTC](https://community.homey.app/t/how-to-get-settings-in-widgets-api-implementation/119381 "2024-10-30T21:02:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Grewenig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/christian_grewenig/32/49383_2.png) [@Christian\_Grewenig](https://community.homey.app/u/Christian_Grewenig)\
**Post date:** [October 30, 2024, 9:02pm UTC](https://community.homey.app/t/how-to-get-settings-in-widgets-api-implementation/119381/1 "2024-10-30T21:02:15Z")

</div>

Hi there,

I try my first widget and configured a settings in the `widget.compose.json` as described in the documentation.

```auto
...
"settings": [{
    "id": "imageServerIp",
    "type" : "text",
    "title": {"en": "IP Address"},
    "value": "http://<ipaddress>/rest/latest",
    "hint": "The IP address for the imaging rest api"
  }],...

```

I created a function in the api.js file. This works fine, the function is called. But how do I retrieve the setting in this function?

```auto
async getLatestImage({ homey, query }) {
    // you can access query parameters like "/?foo=bar" through `query.foo`

    // you can access the App instance through homey.app
    // const result = await homey.app.getSomething();
    // return result;

    // perform other logic like mapping result data

    const imageServerIp = homey.settings.get("imageServerIp"); 
    var settingsKeys = homey.settings.getKeys();

    console.log(`ServerIP: ${settingsKeys}`);
    return `${imageServerIp}`;
  },

```

The result in `imageServerIp` is always null…

regards,  
Christian

---

<div class="post-metadata">

**Author:** ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)\
**Post date:** [October 31, 2024, 12:47pm UTC](https://community.homey.app/t/how-to-get-settings-in-widgets-api-implementation/119381/2 "2024-10-31T12:47:13Z")

</div>

You can only get the widget settings from within the widget HTML page. See [https://apps.developer.homey.app/the-basics/widgets/settings](https://apps.developer.homey.app/the-basics/widgets/settings) accessing settings.

So you will need to pass in the widgets settings via the API call as part of the query parameter.

---

<div class="post-metadata">

**Author:** ![Elmar](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/elmar/32/131852_2.png) [@Elmar](https://community.homey.app/u/Elmar)\
**Post date:** [December 13, 2024, 9:39pm UTC](https://community.homey.app/t/how-to-get-settings-in-widgets-api-implementation/119381/3 "2024-12-13T21:39:08Z")

</div>

How is is possible to SET / UPDATE the settings for the widget. there is only getSettings() but not able to update or setSettings

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [December 14, 2024, 8:34am UTC](https://community.homey.app/t/how-to-get-settings-in-widgets-api-implementation/119381/4 "2024-12-14T08:34:28Z")

</div>

Not possible.

---

<div class="post-metadata">

**Author:** ![Elmar](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/elmar/32/131852_2.png) [@Elmar](https://community.homey.app/u/Elmar)\
**Post date:** [December 21, 2024, 11:58am UTC](https://community.homey.app/t/how-to-get-settings-in-widgets-api-implementation/119381/5 "2024-12-21T11:58:10Z")

</div>

Can I make a request somewhere for Homey to implement this this is really needed. you need to be able to update your settings somewhere. Now Im working with sessionStorage.  
Or is there an eventlister when saving the widget settings.
