USACE / USACE/cwms-data-api

Post ratings issue

Open
#1,758 7 comments 0 reactions 2 assignees View on GitHub

@adamkorynta is already working on this.

Since Jun 2, 2026.

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

Description

Summary: The response from the Get ratings endpoint is not the accepted format for the Post ratings endpoint.

Details/Steps to Reproduce Error:

I tried to use Swagger to get a rating from prod and post it in dev.

This is the Get from prod:

curl -X 'GET' \
  'https://cwms.sec.usace.army.mil/cwms-data/ratings?name=FSMI.Stage%3BFlow.EXSA.PRODUCTION&office=SWT&_cb=1780332727652' \
  -H 'accept: application/json' \
  -H 'Cache-Control: no-cache, no-store, max-age=0' \
  -H 'Pragma: no-cache'

This is the response back:

{
  "ratings": {
    "query-info": {
      "time-of-query": "2026-06-01T16:52:08Z",
      "process-query": "PT3.394S",
      "format-output": "PT3.050S",
      "requested-format": "JSON",
      "requested-office": "SWT",
      "requested-start-time": "2026-05-31T16:52:08Z",
      "requested-end-time": "2026-06-01T16:52:08Z",
      "requested-items": [
        {
          "name": "FSMI.Stage;Flow.EXSA.PRODUCTION",
          "unit": "NATIVE",
          "datum": "NATIVE"
        }
      ],
      "templates-retrieved": 1,
      "total-specifications-retrieved": 1,
      "unique-specifications-retrieved": 1,
      "total-ratings-retrieved": 1,
      "unique-ratings-retrieved": 1
    },
    "rating-templates": [
      {
        "office": "SWT",
        "name": "Stage;Flow.EXSA",
        "parameters-string": "Stage;Flow",
        "version": "EXSA",
        "ind-parameters": [
          {
            "name": "Stage",
            "value-lookup-in-range": "LINEAR",
            "value-lookup-below-range": "NEAREST",
            "value-lookup-above-range": "NEAREST"
          }
        ],
        "dep-parameter": "Flow",
        "description": null
      }
    ],
    "rating-specs": [
      {
        "office": "SWT",
        "name": "FSMI.Stage;Flow.EXSA.PRODUCTION",
        "location": "FSMI",
        "version": "PRODUCTION",
        "source-agency": null,
        "time-lookup-in-range": "PREVIOUS",
        "time-lookup-before-first": "NEAREST",
        "time-lookup-after-last": "PREVIOUS",
        "rounding": {
          "ind-parameters": [
            "2223456784"
          ],
          "dep-parameter": "2223456784"
        },
        "description": "FSMI Expanded, Shift-Adjusted PRODUCTION Stream Rating"
      }
    ],
    "ratings": [
      {
        "simple-rating": {
          "office": "SWT",
          "name": "FSMI.Stage;Flow.EXSA.PRODUCTION",
          "ind-parameters": [
            "Stage (ft)"
          ],
          "dep-parameter": "Flow (cfs)",
          "effective-date": "2007-07-11T20:38:00Z",
          "description": null,
          "values": [
            [
              17,
              114000
            ],
            [
              18.75,
              140000
            ],
            [
              20.47,
              165558
            ],
            [
              30,
              313800
            ],
            [
              30.4,
              320500
            ],
            [
              30.84,
              328800
            ],
            [
              31,
              332200
            ],
            [
              31.29,
              339300
            ],
            [
              31.4,
              342500
            ],
            [
              31.62,
              349500
            ],
            [
              32.26,
              372000
            ],
            [
              36,
              520000
            ]
          ]
        }
      }
    ]
  }
}

Then I tried to put that response into the Post ratings for dev:

curl -X 'POST' \
  'https://water.dev.cwbi.us/cwms-data/ratings' \
  -H 'accept: */*' \
  -H 'Content-Type: application/xml;version=2' \
  -H 'Cache-Control: no-cache, no-store, max-age=0' \
  -H 'Pragma: no-cache' \
  -d '{
  "ratings": {
    "query-info": {
      "time-of-query": "2026-06-01T16:52:08Z",
      "process-query": "PT3.394S",
      "format-output": "PT3.050S",
      "requested-format": "JSON",
      "requested-office": "SWT",
      "requested-start-time": "2026-05-31T16:52:08Z",
      "requested-end-time": "2026-06-01T16:52:08Z",
      "requested-items": [
        {
          "name": "FSMI.Stage;Flow.EXSA.PRODUCTION",
          "unit": "NATIVE",
          "datum": "NATIVE"
        }
      ],
      "templates-retrieved": 1,
      "total-specifications-retrieved": 1,
      "unique-specifications-retrieved": 1,
      "total-ratings-retrieved": 1,
      "unique-ratings-retrieved": 1
    },
    "rating-templates": [
      {
        "office": "SWT",
        "name": "Stage;Flow.EXSA",
        "parameters-string": "Stage;Flow",
        "version": "EXSA",
        "ind-parameters": [
          {
            "name": "Stage",
            "value-lookup-in-range": "LINEAR",
            "value-lookup-below-range": "NEAREST",
            "value-lookup-above-range": "NEAREST"
          }
        ],
        "dep-parameter": "Flow",
        "description": null
      }
    ],
    "rating-specs": [
      {
        "office": "SWT",
        "name": "FSMI.Stage;Flow.EXSA.PRODUCTION",
        "location": "FSMI",
        "version": "PRODUCTION",
        "source-agency": null,
        "time-lookup-in-range": "PREVIOUS",
        "time-lookup-before-first": "NEAREST",
        "time-lookup-after-last": "PREVIOUS",
        "rounding": {
          "ind-parameters": [
            "2223456784"
          ],
          "dep-parameter": "2223456784"
        },
        "description": "FSMI Expanded, Shift-Adjusted PRODUCTION Stream Rating"
      }
    ],
    "ratings": [
      {
        "simple-rating": {
          "office": "SWT",
          "name": "FSMI.Stage;Flow.EXSA.PRODUCTION",
          "ind-parameters": [
            "Stage (ft)"
          ],
          "dep-parameter": "Flow (cfs)",
          "effective-date": "2007-07-11T20:38:00Z",
          "description": null,
          "values": [
            [
              17,
              114000
            ],
            [
              18.75,
              140000
            ],
            [
              20.47,
              165558
            ],
            [
              30,
              313800
            ],
            [
              30.4,
              320500
            ],
            [
              30.84,
              328800
            ],
            [
              31,
              332200
            ],
            [
              31.29,
              339300
            ],
            [
              31.4,
              342500
            ],
            [
              31.62,
              349500
            ],
            [
              32.26,
              372000
            ],
            [
              36,
              520000
            ]
          ]
        }
      }
    ]
  }
}'

And I got back a 500 error. I tried to get the error out of Graphana- I found this:

01-Jun-2026 17:19:51.557 WARNING [http-nio-7000-exec-39] cwms.cda.ApiServlet.lambda$init$9 error on request[bd185434-3dd8-4820-afa3-0913de779a0f]: /cwms-data/timeseries

We did find a work-around; if I use the Get for one in prod:

curl -X 'GET' \
  'https://cwms.sec.usace.army.mil/cwms-data/ratings/FSMI.Stage%3BFlow.EXSA.PRODUCTION?office=SWT&_cb=1780333374827' \
  -H 'accept: application/json;version=2' \
  -H 'Cache-Control: no-cache, no-store, max-age=0' \
  -H 'Pragma: no-cache'

Then I can post that response in dev ratings and it works.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.