Skip to content

v2: rewrite for the new OCI-hosted ForestSens API - #1

Merged
JohannesRahlf merged 1 commit into
mainfrom
v2-new-api
Aug 31, 2026
Merged

v2: rewrite for the new OCI-hosted ForestSens API#1
JohannesRahlf merged 1 commit into
mainfrom
v2-new-api

Conversation

@JohannesRahlf

Copy link
Copy Markdown
Member

Real breaking rewrite -- the platform moved off the old Oracle APEX API onto a new OCI-hosted one, so this client's entire surface changed to match. Left open per usual practice, nothing auto-merges.

Scope deliberately narrow for v1: upload, batch, download only (plus pipeline discovery as supporting plumbing). No API-key management, no typed result tables, no batch retry/list yet.

  • Package renamed ForestSensAPI/ -> forestsens/ (real import/distribution name now).
  • Auth: X-Api-Key header, calls go through the dedicated /v1-key/{path*} Gateway route.
  • Uploads: PUT-to-PAR for small files, resumable backend-mediated chunked multipart for large ones -- logic ported from the platform's own verified frontend implementation. Dropped the oci SDK dependency entirely (PARs never supported real OCI multipart).
  • Batches: create_batch/get_batch/wait_for_batch (polls to done/failed, raises BatchFailedError with step detail).
  • Downloads: download_artifacts() streams each artifact's live PAR URL to a local dir.
  • Structured error handling (ForestSensAPIError parses the API's own {data,meta,error} envelope) instead of only checking HTTP status.
  • Modern pyproject.toml (PEP 621), pytest, a CI workflow (none existed before).

12/12 tests pass (mocked HTTP, no live backend needed). Still to do before merging: a real manual smoke test against the deployed Gateway with a real API key.

🤖 Generated with Claude Code

Real breaking rewrite, not a patch -- the platform moved off the old
Oracle APEX API onto a new OCI-hosted one, so this client's entire
surface changed to match:

- Package renamed ForestSensAPI/ -> forestsens/ (matches the real
  import/distribution name now, "forestsens").
- Auth: X-Api-Key header (not apitoken), calls go through the
  dedicated /v1-key/{path*} Gateway route.
- Uploads: PUT-to-PAR for small files, resumable backend-mediated
  chunked multipart for large ones (16 MiB threshold) -- ported the
  logic (not code) from the platform's own verified frontend
  implementation (uploadFiles.ts). Dropped the oci SDK dependency
  entirely: PARs never supported real OCI multipart, so it was dead
  weight.
- Batches: create_batch/get_batch/wait_for_batch (polls to
  done/failed, raises BatchFailedError with step detail on failure).
- Downloads: download_artifacts() streams each artifact's live PAR
  download_url to a local dir.
- list_pipelines() as supporting plumbing (needed to discover a real
  pipeline_id/slot shape before creating a batch).
- Structured error handling: ForestSensAPIError parses the API's own
  {data,meta,error} envelope, mirroring frontend/src/api/client.ts's
  ApiRequestError, instead of only checking HTTP status.
- Modern pyproject.toml (PEP 621) replacing setup.py+requirements.txt;
  pytest replacing bare unittest; a CI workflow (none existed before).

v1 scope deliberately narrow, per explicit instruction: upload, batch,
download only. No API-key management, no typed result tables
(detections/segments/tree-inventory), no batch retry/list -- those
stay on the new API's own roadmap, not duplicated here yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@JohannesRahlf
JohannesRahlf merged commit 945ca9e into main Aug 31, 2026
1 check passed
@JohannesRahlf
JohannesRahlf deleted the v2-new-api branch August 31, 2026 09:06
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