Subscribe to our email list to receive updates about our API here.
How to integrate
You want to start with finding the product you want to order, this is done by looking up the product list for a given municipality, see Get products. You can also contact support if you are unsure about what product to order, support@ambita.com.
Then make sure you are handling push notifications correctly, see Push messages.
Next you want to create an order, this is described in Create an order.
When you have created the order, you should then wait for push messages. We recommend to put push messages on a queue and process them sequentially. What to do with the different statuses is described in the Push messages, but for UPDATE
and FINISHED
, there is a small difference to what should be done.
When you receive an UPDATE
or FINISHED
push message, you should follow this 3-step procedure:
Use the
orderId
and get the order from our API described in Get orderLoop through assets and do necessary actions
Files can occur on both order level and order line level.
Example (JavaScript)
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
{ "id": 1234567, "status": "PROGRESS", ... "orders": [ { "id": 1234567, "supplierName": "Infoland Kommune - demo", "assets": [ ... ], ... "orderLines": [ { "id": 12345678, "assets": [ ... ]
Take a look at the Get 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
.