How to delete Finder Order / Order Product via API
How to delete Order / Order Product
Using Finder API you can delete an entire order or just individual products.
To do that please make sure that you have Openstack CLI installed on your operating system. You have to also obtain KeyCloak.
How to install Openstack Client on Linux
How to install Openstack Client on Windows
How to obtain KeyCloak Token / Order products using API
Deleting an entire order
To delete an entire order you can use following command: "curl -X DELETE https://finder.creodias.eu/api/order/*order_ID*/ -H "Content-Type: application/json" -H "Keycloak-Token: ${KEYCLOAK_TOKEN}" | python3 -m json.tool"
Example for Order 1319047
llesiak@llesiakNB:~$ curl -X DELETE https://finder.creodias.eu/api/order/1319047/ -H "Content-Type: application/json" -H "Keycloak-Token: ${KEYCLOAK_TOKEN}" | python3 -m json.tool
As you can see the whole order has been deleted (canceled).
Deleting Order Products
To delete an product you'll need product item ID.
To get ID of Item that you've ordered please use this request: "curl -X GET https://finder.creodias.eu/api/order/*order_ID*/order_items -H "Content-Type: application/json" -H "Keycloak-Token: ${KEYCLOAK_TOKEN}" | python3 -m json.tool"
As a result you'll get details of an order. Example for order 1317258.
llesiak@llesiakNB:~$ curl -X GET https://finder.creodias.eu/api/order/1317258/order_items -H "Content-Type: application/json" -H "Keycloak-Token: ${KEYCLOAK_TOKEN}" | python3 -m json.tool { "items": [ { "id": 2491216, "name": "S2A_MSIL1C_20190228T110001_N0207_R094_T31VEG_20190228T111324", "status": "done", "add_date": "2022-01-14T14:05:59.329727+00:00", "mod_date": "2022-01-14T14:06:05.849253+00:00", "extra_info": "", "result": { "processed_name": "S2A_MSIL2A_20190228T110001_N0211_R094_T31VEG_20190228T113827", "processed_size": 673655801, "processing_metadata": {} }, "order": { "extra": null } } ], "total": 1, "page": 0, "size": 10 }
After getting product ID you can delete it using this command: "curl -X DELETE https://finder.creodias.eu/api/order_item/*order_Item_ID*-H "Content-Type: application/json" -H "Keycloak-Token: ${KEYCLOAK_TOKEN}" | python3 -m json.tool"
Example for product 2493999.
llesiak@llesiakNB:~$ curl -X DELETE https://finder.creodias.eu/api/order_item/2493999 -H "Content-Type: application/json" -H "Keycloak-Token: ${KEYCLOAK_TOKEN}" | python3 -m json.tool { "id": 2493999, "name": "S2A_MSIL2A_20220113T194651_N0301_R099_T07LCL_20220113T214508.SAFE", "status": "cancelled", "add_date": "2022-01-18T14:25:00.387474+00:00", "mod_date": "2022-01-18T17:27:17.144279+00:00", "extra_info": "", "result": { "processed_name": "S2A_MSIL2A_20220113T194651_N0301_R099_T07LCL_20220113T214508", "processed_size": 153890883, "processing_metadata": null }, "order": { "extra": null } }
As you can see only one product has been deleted.