Skip to content

Add template-based device HTTP API - #1256

Open
floitsch wants to merge 2 commits into
floitsch/build-artemis-service.s-new.130from
floitsch/build-artemis-service.s-new.140
Open

Add template-based device HTTP API#1256
floitsch wants to merge 2 commits into
floitsch/build-artemis-service.s-new.130from
floitsch/build-artemis-service.s-new.140

Conversation

@floitsch

@floitsch floitsch commented Aug 27, 2026

Copy link
Copy Markdown
Member

Depends on #1255.

Summary

  • add a dedicated device Edge Function with conventional goal, state, and event routes
  • embed one URL template per BrokerConnection operation in newly generated device configurations
  • download images and firmware directly from public artifact storage, including ranged firmware downloads
  • remove the old binary /b transport from newly built services
  • extend the in-memory HTTP broker with the same device and artifact contract

The templates can independently address goal reads, image downloads, firmware downloads, state reports, and event reports. Common substitutions are {device-id} and {organization-id}; operation-specific substitutions include {wait}, {id}, {word-size}, {offset}, and {type}. The built-in Supabase and HTTP configurations hardcode the current routes, while custom servers can split these operations across different endpoints.

The device configuration contains complete http:// or https:// URLs, so the new service path does not carry a separate TLS flag.

Device API

  • GET /device/{device-id}/goal
  • PUT /device/{device-id}/state
  • POST /device/{device-id}/events

Testing

  • toit analyze on the changed service/config/test-server sources
  • toit run --project-root tests tests/server-config-test.toit
  • toit run --project-root tests tests/broker-test.toit -- --http-toit-broker
  • toit run --project-root tests tests/broker-test.toit -- --http-toit-combined-broker
  • deno fmt --check and deno check --no-lock for both new Edge Functions

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.

1 participant