-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
Hey folks. Locally (with remote AWS OpenSearch) working with Geoportal 2.7.2 here. Trying to POST at first a collection but then items to a STAC collection I configured through the API form. I can send a collection object and item for it through the API form no problem, but trying to use Python subprocess on curl is proving weird. Here's the item object:
test_item_obj = {
"type": "Feature",
"stac_version": "1.1.0",
"id": "some-dataset-id-label",
"geometry": {
"type": "Point",
"coordinates": [
-87.8496,
43.098
]
},
"bbox": [
-87.84961,
43.097989999999996,
-87.84958999999999,
43.09801
],
"properties": {
"title": "Some dataset",
"description": "Some description for the organization\'s dataset. There is an apostrophe.",
"keywords": [
"some",
"keywords",
"here"
],
"extra_info": 2,
"start_datetime": "2012-07-26T20:30:00Z",
"end_datetime": "2025-04-01T19:30:00Z"
},
"links": [
{
"rel": "root",
"href": "../catalog.json",
"type": "application/json",
"title": "Org STAC"
},
{
"rel": "parent",
"href": "../catalog.json",
"type": "application/json",
"title": "Org STAC"
}
],
"assets": {
"json-metadata": {
"href": "https://some.erddap.url.org/erddap/dataset/index.json",
"type": "application/json",
"title": "ERDDAP JSON metadata",
"roles": [
"metadata"
]
}
}
}
Here's the chunk attempting to post to geoportal, with gp_token
acquired:
test_item_string = json.dumps(test_item_obj)
test_collection_id = "test_stac_collection"
gp_item_input_url = f"http://localhost:8082/geoportal/stac/collections/{test_collection_id}/items?access_token={gp_token}"
curl_item_post_com = ['curl', '-X', 'POST', gp_item_input_url, '-H', "'Content-Type: application/json'", '-H', "'accept: application/json'", '-d', f'{test_item_string}']
curl_item_post_res = subprocess.run(curl_item_post_com, capture_output=True)
I get the following error, with a whole bunch of Java stack trace following, starts at com.esri.geoportal.search.STACService.item(STACService.java:731)
... internal logs on the docker container running it reveal no more detail:
java.lang.ClassCastException: class java.lang.String cannot be cast to class net.minidev.json.JSONObject (java.lang.String is in module java.base of loader 'bootstrap'; net.minidev.json.JSONObject is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @33bd78e1) Description : The server encountered an unexpected condition that prevented it from fulfilling the request. Exception: javax.servlet.ServletException: java.lang.ClassCastException: class java.lang.String cannot be cast to class net.minidev.json.JSONObject (java.lang.String is in module java.base of loader 'bootstrap'; net.minidev.json.JSONObject is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader...
Please advise, and let me know if you need more information.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels