feat(cli): Add af api command for direct Airflow REST API access
#73
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.
Summary
Add a generic
af apicommand that provides direct access to any Airflow REST API endpoint, similar togh apifor GitHub. This enables users and AI agents to access any API endpoint not covered by the high-level CLI commands.Features
-Xflag-F key=value(auto type conversion) or-f key=value(raw string)--body '{...}'for complex payloads--endpointslists available paths,--filternarrows results--specfetches full API spec-iincludes status code and headers--rawbypasses version prefix (for/health, etc.)/api/v1) vs AF3 (/api/v2) detectionUsage Examples
Design Decisions
Why add to adapter vs direct HTTP?
The adapter pattern already handles authentication (token/basic auth via
_setup_auth()) and version prefixes. Addingraw_request()to the base adapter keeps the architecture consistent.Why
--endpointsinstead of requiring jq?Not all users have jq installed, and endpoint discovery is a common operation. The
--filteroption makes it easy to find specific endpoints without external tools.Why warn on connections endpoint?
Unlike
af config connectionswhich filters passwords,af api connectionsreturns raw API responses. The warning directs users to the filtered alternative.Files Changed
adapters/base.pyraw_request()and_delete()methodscli/api.pycli/main.pytests/test_cli_api.pytests/integration/test_cli_api.pyREADME.mdskills/airflow/SKILL.mdskills/airflow/api-reference.md