# Developer Web API Playground - Notes of geeky oneliners

**URL:** <https://community.homey.app/t/developer-web-api-playground-notes-of-geeky-oneliners/24392>\
**Category:** Developers\
**Created:** [January 13, 2020, 9:08pm UTC](https://community.homey.app/t/developer-web-api-playground-notes-of-geeky-oneliners/24392 "2020-01-13T21:08:40Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![tb1962](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tb1962/32/7888_2.png) [@tb1962](https://community.homey.app/u/tb1962)\
**Post date:** [May 23, 2021, 6:40am UTC](https://community.homey.app/t/developer-web-api-playground-notes-of-geeky-oneliners/24392/8 "2021-05-23T06:40:08Z")

</div>

I would like to add one of my favorites. It’s not a one liner but still useful.  
This script lists all unused flows along with its folder path.

**However be carefull if you want to use this script to remove all unused flows. Flows may be used from HomeyScript or set as favorite**. This script only list flows that has a ‘Start as flow’ trigger and for which it can’t find a flow with a flowcard to trigger.

```
'use strict';
const folders = await Homey.flow.getFlowFolders(); 
const flowsDic = await Homey.flow.getFlows();
const flows = Object.values(flowsDic)
const triggers = flows.map(f => f.actions.filter(a => a.uri === 'homey:manager:flow' && 
                                                      a.id === 'programmatic_trigger').map(a => a.args.flow)).flat()
function getFolder(id) {
  if (folders[id]) {
    if (folders[id].parent) {
      return `${getFolder(folders[id].parent)} > "${folders[id].name}"`
    }
    return `"${folders[id].name}"`
  }
  return '';
}
log(`Searching in ${flows.length} flows\n---------------------\n`)
flows.filter(f => f.trigger.uri === 'homey:manager:flow' && 
                  f.trigger.id === 'programmatic_trigger' &&  
                  !triggers.find(t => t.id === f.id)
            ).forEach(flow => log(`${getFolder(flow.folder)} > ${flow.name}`));
```

---

_[View the full topic](https://community.homey.app/t/developer-web-api-playground-notes-of-geeky-oneliners/24392)._
