Skip to content

Conversation

@ipspace
Copy link
Owner

@ipspace ipspace commented Jan 23, 2026

The /status API call can now return usable JSON data

The /status API call can now return usable JSON data
@ipspace
Copy link
Owner Author

ipspace commented Jan 23, 2026

@sdargoeuves @captainpacket -- here's the API implementation of "netlab status" as a usable data structure.

I also did a bit of a cleanup, hopefully resulting in a more generic "get" method that can handle multiple multi-part requests.

I wanted to retain the "old" /status results in case anyone already uses them, so you get the JSON data structure back only with "/status/json" or "/status/json/instance". I would love to have a better idea how to handle that. Any suggestions?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds JSON-formatted responses to the /status API endpoint and refactors the API request handler routing logic for better maintainability.

Changes:

  • Added generic send_reply and send_error helper functions for consistent response handling
  • Enhanced /status endpoint to support JSON output and instance-specific queries
  • Refactored GET request routing to use separate handler dictionaries for simple and path-based endpoints
  • Updated default bind address to use external_commands.get_local_addr() instead of hardcoded localhost
  • Added KeyboardInterrupt handling and improved server startup logging with protocol information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants