brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: switch on the GraphQL sandbox to try Unraid API queries in your browser

Unraid
~/tips/tip-unraid-api-graphql-sandbox

unraid-api developer --sandbox true

Test Unraid API queries in a browser playground before you put them in a script.

Writing an API query blind is no fun. You guess a field name, get an error, guess again. Unraid has a playground for exactly this, it is just switched off by default.

The docs call the WebGUI route the recommended one: go to Settings > Management Access > Developer Options and enable the GraphQL Sandbox toggle. From the terminal it is one command:

unraid-api developer --sandbox true

Then open http://YOUR_SERVER_IP/graphql in your browser, so something like http://192.168.1.10/graphql. You get an Apollo sandbox where you can type a query and see the answer right away. This one from the docs lists your containers:

query {
    dockerContainers {
        id
        names
        state
        status
        autoStart
    }
}

I like that last field. With a lot of containers it is a quick way to see which ones have autostart on without scrolling the Docker tab. The docs also suggest starting with small queries and adding fields as you go, which is how I’d use the sandbox anyway: build the query there, copy it into your script when it works.

Most queries need authentication, either the cookie from being signed in to the WebGUI or an API key in an x-api-key header.

The caveat is that this is a developer tool. When you have your query, turn it off again with unraid-api developer --sandbox false or the same toggle.

Further reading: Unraid docs: Using the Unraid API, Unraid docs: CLI commands

More Unraid tips Change the RAID profile of a Unraid BTRFS pool with Balance Replace a disk in a redundant Unraid pool from the Main tab Test every Unraid drive with the DiskSpeed container See the XML behind a VM with the inline XML view in Unraid 7 Choose where a new VM's disk image is created with Unraid's storage override All Unraid tips (77) All topics

Link