cmr-stac icon indicating copy to clipboard operation
cmr-stac copied to clipboard

some /search GET requests are broken

Open hrodmn opened this issue 4 months ago • 1 comments

It appears that there is a problem in the API when it comes to parsing GET request parameters.

Related issue: #348

Working - this request returns an item collection with one item and shows that there are 30 results for the query:

curl -X GET "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55,35.64,-105.31,35.81&datetime=2024-01-01T00:00:00Z/2024-09-24T00:00:00Z&limit=1&collections=HLSL30_2.0" | jq

Not working - an almost identical request but with two collections separated by commas returns an empty item collection and shows that there are zero results for the query:

curl -X GET "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55,35.64,-105.31,35.81&datetime=2024-01-01T00:00:00Z/2024-09-24T00:00:00Z&limit=1&collections=HLSL30_2.0,HLSS30_2.0"

I don't know exactly what is going on here but it seems like the collections values are not getting correctly parsed as a comma-separated list.

POST requests are working normally:

Working - a POST request with the same parameters as the failing GET request:

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"bbox": [-105.55, 35.64, -105.31, 35.81], "datetime": "2024-01-01T00:00:00Z/2024-09-01T00:00:00Z", "collections": ["HLSL30_2.0", "HLSS30_2.0"], "limit": 1}' \
  "https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search" 

But a GET request to the link ("rel": "next") to the next page from the result of the previous request returns an empty item collection:

curl -X GET \
"https://cmr.earthdata.nasa.gov/stac/LPCLOUD/search?bbox=-105.55%2C35.64%2C-105.31%2C35.81&datetime=2024-01-01T00%3A00%3A00Z%2F2024-09-01T00%3A00%3A00Z&collections=HLSL30_2.0%2CHLSS30_2.0&limit=1&cursor=eyJqc29uIjoiW1wibHBjbG91ZFwiLDE3MDQzMDQ0NDgwMzQsMjgzMjIzMjQwNl0iLCJ1bW0iOiJbXCJscGNsb3VkXCIsMTcwNDMwNDQ0ODAzNCwyODMyMjMyNDA2XSJ9"

This is a big problem for clients that page through results using the "rel": "next" links (like pystac_client) which are able to get the first page of results via a POST request but are failing to retrieve all of the results because the GET requests for the paged results are failing!

hrodmn avatar Sep 24 '24 16:09 hrodmn