Skip to content

Fix Glooko v3 request parameters - #60

Open
lukas-slansky wants to merge 1 commit into
nightscout:mainfrom
lukas-slansky:fix/glooko-v3-request-params
Open

Fix Glooko v3 request parameters#60
lukas-slansky wants to merge 1 commit into
nightscout:mainfrom
lukas-slansky:fix/glooko-v3-request-params

Conversation

@lukas-slansky

Copy link
Copy Markdown

Summary

Prevents Glooko v2 synchronization parameters from being sent to v3 endpoints.

Fixes #59.

Problem

The Glooko fetcher() currently applies the same query parameters to all GET requests:

  • lastGuid
  • lastUpdatedAt
  • limit

These parameters are used by the v2 synchronization endpoints, but Glooko v3 rejects them.

Affected endpoints include:

  • /api/v3/session/users
  • /api/v3/graph/data

Glooko responds with:

HTTP 422
{"error":"found unpermitted parameters: :lastGuid, :lastUpdatedAt, :limit"}

Changes

  • Keeps the existing synchronization parameters as the default for v2 requests.
  • Allows fetcher() to receive explicit request parameters.
  • Calls the v3 session and graph endpoints without the v2-only synchronization parameters.
  • Leaves the existing v3 graph request URL and time range unchanged.

Testing

Regression tests verify that:

  • v2 scheduled basal requests still receive lastGuid, lastUpdatedAt, and limit
  • v2 normal bolus requests still receive them
  • v2 CGM requests still receive them
  • /api/v3/session/users does not receive them
  • /api/v3/graph/data does not receive them

The full test suite passes.

The change was also tested against a real Glooko EU account using the current v3 graph fallback. The v2 CGM endpoint returned no readings, the v3 graph request completed successfully without HTTP 422, and the response produced 821 Nightscout CGM entries.

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.

Glooko v3 requests fail with HTTP 422 due to v2-only query parameters

1 participant