USACE / USACE/cwms-data-api

[Feature]:Allow Posting multiple stream locations in single request

Open
#1,874 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs-follow-up priority:medium
Dominant language
Java
Stars
28
Forks
25
Avg merge
4d 22h
Merged PRs (30d)
20

Description

Describe the bug

Is it the intent of the post stream-locations endpoint to allow multiple stream locations? I can only get one stream-location at a time to work.

Expected behavior

I thought that when I posted three stream-locations, that it would post all three. However, I can only do them individually. Not sure if I've got the formatting incorrect or if it just doesn't accept multiples.

To Reproduce
  1. Go to CDA test swagger, post streamLocations
  2. Select fail-if-exists=false
  3. Put more than one gage in the request body. This is what I used:
[
  {
    "stream-location-node": {
      "id": {
        "office-id": "SWT",
        "name": "DIEB"
      },
      "stream-node": {
        "stream-id": {
          "office-id": "SWT",
          "name": "Saline_R"
        },
        "station": 53,
        "station-units": "mi"
      }
    },
    "area-units": "mile2",
    "stage-units": "ft"
  },
  {
    "stream-location-node": {
      "id": {
        "office-id": "SWT",
        "name": "DIES"
      },
      "stream-node": {
        "stream-id": {
          "office-id": "SWT",
          "name": "Saline_R"
        },
        "station": 48,
        "station-units": "mi"
      }
    },
    "area-units": "mile2",
    "stage-units": "ft"
  },
  {
    "stream-location-node": {
      "id": {
        "office-id": "SWT",
        "name": "LOCK"
      },
      "stream-node": {
        "stream-id": {
          "office-id": "SWT",
          "name": "Saline_R"
        },
        "station": 31,
        "station-units": "mi"
      }
    },
    "area-units": "mile2",
    "stage-units": "ft"
  }
]
Priority

Medium

Logs/Incident Identifier

I got the 500 error "Formatting error:Could not deserialize"

Incident identifier is:
3002d44a-4f01-4adf-a9d8-0068d0146086

CURL Commands
curl -X 'POST' \
  'https://cwms-data-test.cwbi.us/cwms-data/stream-locations?fail-if-exists=false' \
  -H 'accept: */*' \
  -H 'Authorization: REDACTED \
  -H 'Content-Type: application/json;version=1' \
  -H 'Cache-Control: no-cache, no-store, max-age=0' \
  -H 'Pragma: no-cache' \
  -d '[
  {
    "stream-location-node": {
      "id": {
        "office-id": "SWT",
        "name": "DIEB"
      },
      "stream-node": {
        "stream-id": {
          "office-id": "SWT",
          "name": "Saline_R"
        },
        "station": 53,
        "station-units": "mi"
      }
    },
    "area-units": "mile2",
    "stage-units": "ft"
  },
  {
    "stream-location-node": {
      "id": {
        "office-id": "SWT",
        "name": "DIES"
      },
      "stream-node": {
        "stream-id": {
          "office-id": "SWT",
          "name": "Saline_R"
        },
        "station": 48,
        "station-units": "mi"
      }
    },
    "area-units": "mile2",
    "stage-units": "ft"
  },
  {
    "stream-location-node": {
      "id": {
        "office-id": "SWT",
        "name": "LOCK"
      },
      "stream-node": {
        "stream-id": {
          "office-id": "SWT",
          "name": "Saline_R"
        },
        "station": 31,
        "station-units": "mi"
      }
    },
    "area-units": "mile2",
    "stage-units": "ft"
  }
]'
CDA Version

2026.05.12-testf OAS 3.0

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CDA Swagger definition and the POST /stream-locations endpoint, then reproduce the request using the provided curl payload. Determine whether the endpoint accepts an array of stream locations and verify that a request containing all three locations succeeds and creates each one.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.