Skip to content

feat: add GET /api/v1/nodes/{id} detail endpoint#22

Merged
Nic-dorman merged 1 commit intomainfrom
feat-node-detail-endpoint
Apr 1, 2026
Merged

feat: add GET /api/v1/nodes/{id} detail endpoint#22
Nic-dorman merged 1 commit intomainfrom
feat-node-detail-endpoint

Conversation

@Nic-dorman
Copy link
Copy Markdown
Contributor

Summary

Adds a detail endpoint for individual nodes, returning full config + runtime state.

The problem: The status endpoint (GET /api/v1/nodes/status) returns only summary info (id, name, version, status, pid, uptime). GUI clients need access to data_dir, rewards_address, ports, binary_path, etc. — currently only available by reading the node_registry.json file directly, which is fragile (path can be custom).

The fix: GET /api/v1/nodes/{id} returns the existing NodeInfo type — full NodeConfig (flattened via serde) plus runtime state from the supervisor.

Response example

{
  "id": 1,
  "service_name": "node1",
  "rewards_address": "0x1234...",
  "data_dir": "/home/user/.local/share/ant/nodes/node-1",
  "log_dir": null,
  "node_port": null,
  "metrics_port": null,
  "network_id": 1,
  "binary_path": "/home/user/.local/share/ant/nodes/node-1/saorsa-node",
  "version": "0.4.1",
  "env_variables": {},
  "bootstrap_peers": [],
  "status": "running",
  "pid": 12345,
  "uptime_secs": 3600
}

Changes

  • server.rs: Added get_node_detail handler, routed as GET alongside existing DELETE on /api/v1/nodes/{id}
  • daemon_integration.rs: E2e test — verifies full config response, flattened JSON shape, and 404

Tests

  • All 5 daemon integration tests pass
  • Clippy clean, fmt clean

Test plan

  • cargo test -p ant-core --test daemon_integration — 5 pass
  • cargo clippy -p ant-core -- -D warnings clean

🤖 Generated with Claude Code

Returns full NodeConfig (flattened) + runtime state (status, pid,
uptime_secs) for a single node. This gives GUI clients access to
data_dir, rewards_address, ports, binary_path, env_variables, and
bootstrap_peers without reading the registry file directly.

- Uses existing NodeInfo type (config flattened via serde)
- 404 when node ID not found
- Coexists with existing DELETE on the same route path
- E2e test: verifies full config, flattened JSON shape, and 404

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Nic-dorman Nic-dorman merged commit 1fb95f0 into main Apr 1, 2026
11 of 12 checks passed
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