Common-Metadata-Repository icon indicating copy to clipboard operation
Common-Metadata-Repository copied to clipboard

Unable to get "next page of results" when searching STAC features

Open bertcoerver opened this issue 5 months ago • 0 comments

Hello,

I'm trying to do a search on https://cmr.earthdata.nasa.gov/stac/LAADS/search (using Python). My code was working until a few weeks ago, but now I'm not able to retrieve all results when the number of items returned exceeds limit. Here is an example:

import requests

url = 'https://cmr.earthdata.nasa.gov/stac/LAADS/search'

params = {
    'limit': 250,
    'bbox': [
                36.42191632061822,
                32.24152077745001,
                36.56950917300816,
                32.37621048001086
            ],
    'datetime': '2023-03-01T00:00:00Z/2023-09-30T23:59:59Z',
    'collections': ['VNP03IMG.v2']
 }

resp = requests.post(url, json = params)
resp.raise_for_status()

output_01 = resp.json()

next_page = [x for x in output_01["links"] if x["rel"] == "next"][0]

print(len(output_01["features"]))
print(next_page["title"])
print(next_page["href"])

>>> 250
>>> Next page of results
>>> https://cmr.earthdata.nasa.gov/stac/LAADS/search?limit=250&bbox=36.42191632061822%2C32.24152077745001%2C36.56950917300816%2C32.37621048001086&datetime=2023-03-01T00%3A00%3A00Z%2F2023-09-30T23%3A59%3A59Z&collections=VNP03IMG.v2&cursor=eyJqc29uIjoiW1wibGFhZHNcIiwxNjg1NzUxODQwMDAwLDI3MDI2NjQ3NDFdIiwidW1tIjoiW1wibGFhZHNcIiwxNjg1NzUxODQwMDAwLDI3MDI2NjQ3NDFdIn0%3D

So far all is good, I've got 250 features, but now I need to request the next page. Both methods below (using either GET or POST) give me a 500 response:

resp = requests.get(next_page["href"])
resp.raise_for_status()
resp = requests.post(next_page["href"], json = params)
resp.raise_for_status()

Any advice on how to continue? Thanks!

bertcoerver avatar Sep 20 '24 12:09 bertcoerver