Skip to content

Use GET with comma-separated values for multi-value waterdata queries#233

Draft
thodson-usgs wants to merge 1 commit intoDOI-USGS:mainfrom
thodson-usgs:fix-waterdata-get-multivalue
Draft

Use GET with comma-separated values for multi-value waterdata queries#233
thodson-usgs wants to merge 1 commit intoDOI-USGS:mainfrom
thodson-usgs:fix-waterdata-get-multivalue

Conversation

@thodson-usgs
Copy link
Copy Markdown
Collaborator

Closes #210

Summary

The OGC API now supports comma-separated multi-value parameters for fields like monitoring_location_id, parameter_code, and statistic_id (e.g. parameter_code=00060,00010). This means the CQL2 POST path is no longer needed for most services.

_construct_api_requests now:

  • For daily, continuous, latest-daily, latest-continuous, field-measurements, time-series-metadata, channel-measurements: joins list values with commas and sends a single GET request
  • For monitoring-locations: retains the POST+CQL2 path (see note below)

API limitation to note upstream

During development we found that the monitoring-locations collection endpoint returns HTTP 400 for comma-separated values (e.g. hydrologic_unit_code=010802050102,010802050103 or even monitoring_location_id=USGS-A,USGS-B). The POST+CQL2 path is preserved for this service. This may be a gap in the upstream API that could be enabled field-by-field — if the Water Data APIs team enables split-parameter support for monitoring-locations, the _cql2_required_services set in this code can be emptied and the POST branch removed entirely.

Test plan

  • test_construct_api_requests_multivalue_get: verifies GET method and comma-encoded URL for daily with multiple monitoring_location_id / parameter_code values
  • test_construct_api_requests_monitoring_locations_post: verifies POST+CQL2 is still used for monitoring-locations
  • All existing live tests pass (test_get_monitoring_locations_hucs, test_get_latest_continuous, test_get_latest_daily, test_get_daily, etc.)
  • All 93 unit tests pass

🤖 Generated with Claude Code

The OGC API now supports comma-separated values for fields like
monitoring_location_id, parameter_code, and statistic_id, making POST+CQL2
unnecessary for most services. Update _construct_api_requests to join list
params with commas and use GET for daily, continuous, latest-daily,
latest-continuous, field-measurements, time-series-metadata, and
channel-measurements.

The monitoring-locations endpoint does not yet support comma-separated GET
parameters (returns 400); it retains the POST+CQL2 path. Closes DOI-USGS#210.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Expand usage of GET calls in waterdata module

1 participant