Skip to main content

I have an account created and can successfully get a bearer token, but have been unable to get anything but a 400 (Bad Request) returned from queries.


I’m following: Catalog API


I’m using python requests and placing my token in the header


headers = {"Authorization": f"Bearer {token}", 'Accept':'application/geo+json'}
sentinel_stac_url = 'https://services.sentinel-hub.com/api/v1/catalog/1.0.0/search'
post_data = {"limit": 50,
"datetime": "2023-01-01T00:00:00Z/2023-01-07T00:00:00Z",
"collections": s"sentinel-1-grd"]
}
query_response = requests.post(url=sentinel_stac_url, headers=headers, json=post_data, verify=False)

I just tried adding a random bbox in the query and got a 200. I don’t see any documentation on required fields. Hopefully that helps someone else.


One more related question if anyone may know. I’d like to query multiple collections in one requests, but get a 400 doing that.


Using something like this in the post data: collections: :sentinel-1-grd, sentinel-2-l1c, sentinel-2-l2a]


I’ve queried other providers STAC api and was able to exclude the collections field all together and get everything back. Doesn’t seem to be the case here.


Hi Eric,


To answer your first question, it seems that you didn’t include an area of interest in your request. You can build a Catalog API request using python requests with the following:


import requests

url = "https://services.sentinel-hub.com/api/v1/catalog/1.0.0/search"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {token}"
}
data = {
"collections": :
"sentinel-1-grd"
],
"datetime": "2023-01-01T00:00:00Z/2023-01-07T23:59:59Z",
"intersects": {
"type": "Polygon",
"coordinates": :


12.487366,
41.907898
],

12.541001,
41.893716
],

12.511216,
41.88247
],

12.498519,
41.891033
],

12.468492,
41.890522
],

12.482218,
41.906238
],

12.487366,
41.907898
]
]
]
},
"limit": 10
}

response = requests.post(url, headers=headers, json=data

My example that I built in Request Builder (a great app to get familiar with the APIs) will return one result with the parameters I provided.


To answer your second question, you are limited to searching for a single data collection when using Catalog API.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.


Reply