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