-
-
Notifications
You must be signed in to change notification settings - Fork 52
Add API Explorer app #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
agners
wants to merge
3
commits into
master
Choose a base branch
from
add-api-explorer-app
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add API Explorer app #208
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # API Explorer | ||
|
|
||
| ## About | ||
|
|
||
| API Explorer is a development and debugging tool for Home Assistant app and integration developers. It lets you see exactly what Supervisor's ingress proxy does to requests and test Core API endpoints without leaving the browser. | ||
|
|
||
| ## Panels | ||
|
|
||
| ### Ingress Headers | ||
|
|
||
| Displays all HTTP headers arriving at the app after Supervisor's ingress proxy has processed the request. Useful for verifying that user identity headers (`X-Remote-User-Id`, `X-Remote-User-Name`, `X-Remote-User-Display-Name`) and forwarding headers (`X-Forwarded-For`, `X-Forwarded-Host`, `X-Forwarded-Proto`) are set correctly. | ||
|
|
||
| ### API Request Builder | ||
|
|
||
| Send arbitrary HTTP requests to the Home Assistant Core API via the Supervisor proxy. The app authenticates using its `SUPERVISOR_TOKEN` automatically. The full response (status code, headers, and body) is displayed for inspection. | ||
|
|
||
| ### Quick Actions | ||
|
|
||
| One-click buttons for commonly used API endpoints: status, config, states, services, and events. | ||
|
|
||
| ## Configuration | ||
|
|
||
| This app has no configuration options. It uses `homeassistant_api: true` to access the Core API through Supervisor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ARG BUILD_FROM | ||
| FROM ${BUILD_FROM} | ||
|
|
||
| RUN pip3 install --no-cache-dir aiohttp==3.11.12 | ||
|
|
||
| COPY rootfs / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # API Explorer | ||
|
|
||
| A development app for Home Assistant that provides a web UI (via ingress) to inspect Supervisor ingress behavior and test Home Assistant Core API calls. | ||
|
|
||
| ## What it does | ||
|
|
||
| - **Ingress Header Inspector**: Shows all HTTP headers that Supervisor's ingress proxy sends to apps, including `X-Remote-User-Id`, `X-Remote-User-Display-Name`, `X-Forwarded-For`, etc. | ||
| - **API Request Builder**: Make API calls to Home Assistant Core through the Supervisor proxy (`http://supervisor/core/api/...`) with configurable method, path, headers, and JSON body. | ||
| - **Quick Actions**: Preset buttons for common Core API endpoints like `/api/states`, `/api/config`, and `/api/services`. | ||
|
|
||
| ## Usage | ||
|
|
||
| 1. Copy this folder to `/addons/` on a Home Assistant OS or Supervised system | ||
| 2. In the HA UI: Settings > Apps > App Store > reload | ||
| 3. Find "API Explorer" in local apps, install and start | ||
| 4. Open via the sidebar panel | ||
|
|
||
| ## Architecture | ||
|
|
||
| The app runs a lightweight aiohttp Python server inside an HA base container with s6-overlay. The browser cannot reach `http://supervisor` directly (it's Docker-internal), so the app server acts as a proxy for API calls. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| build_from: | ||
| aarch64: ghcr.io/home-assistant/aarch64-base-python:3.13-alpine3.21 | ||
| amd64: ghcr.io/home-assistant/amd64-base-python:3.13-alpine3.21 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: API Explorer | ||
| version: "1.0.0" | ||
| slug: api_explorer | ||
| description: Inspect ingress headers and test Home Assistant Core API calls through Supervisor | ||
| url: https://www.home-assistant.io | ||
| arch: | ||
| - amd64 | ||
| - aarch64 | ||
| image: homeassistant/{arch}-app-api-explorer | ||
| ingress: true | ||
| ingress_port: 8099 | ||
| panel_icon: mdi:api | ||
| panel_title: API Explorer | ||
| homeassistant_api: true | ||
| init: false | ||
| startup: application | ||
| boot: manual | ||
agners marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.