...
Use the
orderId
and get the order from our API described in Orders.Loop through assets and do necessary actionsFiles , files can occur on both order level and order line level.
Example (provided in JavaScript)
Code Block language js fetch('https://beta-api.ambita.com/kode/v1/orders/:orderId') .then(response => { response.orders.forEach(order => { if (order.assets.length > 0) { // loop through order assets and do necessary actions } order.orderLines.forEach(orderLine => { if (orderLine.assets.length > 0) { // loop through order line assets and do necessary actions } }); }); });
Delete or save the file
Response from
https://beta-api.ambita.com/kode/v1/orders/:orderId
Code Block language json { "id": 1234567, "status": "PROGRESS", ... "orders": [ { "id": 1234567, "supplierName": "Infoland Kommune - demo", "assets": [ ... ], ... "orderLines": [ { "id": 12345678, "assets": [ ... ]
Take a look at the Delivered Files section, the id of the asset will be unique and should be stored in your system. Use this id as a reference to check if you have downloaded the asset before, this way you won’t end up with duplicates. You should also check the status of the asset and delete the file if it has status
DELETED
.
...