Skip to content

Storing a Location with a set KIND does not respect the KIND #1573

@krowvin

Description

@krowvin

Describe the bug
Attempting to add a location via the POST endpoint and using metadata with KIND/TYPE in it.

Expected behavior
The TYPE will be kept, however, the KIND reverts back to SITE.

Expect new location to be created with SITE and then automatically converted to new KIND given the kind provided

To Reproduce
Steps to reproduce the behavior:

  1. Query previous location/kind from prod CDA
  2. Enter location to a POST for location in DEV swagger
  3. Execute and view results

Logs/Incident Identifier
When you receive an error if possible add your corresponding log output. This will be from the Tomcat logs.
If you do not have access to this, ignore this section!

CURL Commands

curl -X 'POST' \
  'https://water.dev.cwbi.us/cwms-data/locations?fail-if-exists=false&_cb=1770658256481' \
  -H 'accept: */*' \
  -H 'Authorization: Bearer redacted' \
  -H 'Content-Type: application/json' \
  -H 'Cache-Control: no-cache, no-store, max-age=0' \
  -H 'Pragma: no-cache' \
  -d '{
    "office-id": "SWT",
    "name": "Baron_Fork_R",
    "latitude": 35.85083,
    "longitude": -94.91398,
    "active": true,
    "public-name": "Baron Fork River",
    "long-name": "Baron Fork River",
    "timezone-name": "US/Central",
    "location-type": "Stream",
    "location-kind": "STREAM",
    "nation": "US",
    "state-initial": "OK",
    "county-name": "Cherokee",
    "nearest-city": "Park Hill, OK",
    "horizontal-datum": "NAD83",
    "vertical-datum": "NGVD29",
    "map-label": "Baron Fork River",
    "bounding-office-id": "SWT",
    "elevation-units": "ft"
  }'

Gives a 201, however query the location again and you get:

{
    "office-id": "SWT",
    "name": "Baron_Fork_R",
    "latitude": 35.85083,
    "longitude": -94.91398,
    "active": true,
    "public-name": "Baron Fork River",
    "long-name": "Baron Fork River",
    "timezone-name": "US/Central",
    "location-type": "Stream",
    "location-kind": "SITE",
    "nation": "US",
    "state-initial": "OK",
    "county-name": "Cherokee",
    "nearest-city": "Park Hill, OK",
    "horizontal-datum": "NAD83",
    "vertical-datum": "NGVD29",
    "map-label": "Baron Fork River",
    "bounding-office-id": "SWT",
    "elevation-units": "ft"
  },

CDA Version (please complete the following information):

  • Version 2026.02.09-develop

Additional context
Attempting to create a STREAM in the CDA Endpoints call on 02/09/2025 we got the following ERROR after trying to load a location with the STREAM KIND.

curl -X 'POST' \
  'https://water.dev.cwbi.us/cwms-data/streams?fail-if-exists=false&_cb=1770658393704' \
  -H 'accept: */*' \
  -H 'Authorization: Bearer redacted' \
  -H 'Content-Type: application/json;version=1' \
  -H 'Cache-Control: no-cache, no-store, max-age=0' \
  -H 'Pragma: no-cache' \
  -d ' {
    "starts-downstream": false,
    "flows-into-stream-node": {
      "stream-id": {
        "office-id": "SWT",
        "name": "Illinois_R"
      },
      "bank": "L",
      "station": 37.81,
      "station-units": "mi"
    },
    "length": 56.01,
    "length-units": "mi",
    "slope-units": "%",
    "id": {
      "office-id": "SWT",
      "name": "Baron_Fork_R"
    }
  }'

results in

{
  "message": "ORA-20034: ITEM_DOES_NOT_EXIST: CWMS stream identifier. \"SWT/Illinois_R\" does not exist.",
  "incidentIdentifier": "622add38-8d55-422f-9615-67eecbb86393",
  "source": "Database",
  "details": {}
}

(We tried with more than one river, they do not match here)

Alternatives

I attempted to use the PATCH endpoint to "upgrade" the kind from SITE to STREAM. If i'm not mistaken there's a PLSQL Procedure to handle kind conversions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions