Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Subscribe to our email list to receive updates about our API here.

...

Authentication

Before you start you need to obtain the following information

...

More information about OAuth can be found here: https://www.oauth.com/

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.

...

  1. Use the orderId and get the order from our API described in Get order

  2. Loop through assets and do necessary actions

    Files can occur on both order level and order line level.

    Example (JavaScript)

    Code Block
     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
             }
           });
         })
       });
    
  3. Delete or save the file

    Response from https://beta-api.ambita.com/kode/v1/orders/:orderId

    Code Block
     {
       "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.

Create an order

To create an order, you need to use the access_token that you previously obtained.

...

Code Block
{
  "id": 1664984,
  "status": "NEW",
  "priceNet": 0,
  "priceVat": 0,
  "dateOrdered": "2021-01-28T09:10:15+0100",
  "dateStatus": "2021-01-28T09:10:15+0100",
  "orders": [
    {
      "id": 2640649,
      "supplierName": "Tromsø kommune",
      "user": "Test User",
      "technicalReference": null,
      "orderLines": [
        {
          "id": 11603164,
          "status": {
            "code": "NEW",
            "name": "New order. Has not been processed yet."
          },
          "product": "WI54016101",
          "productName": "Basiskart som vektordata",
          "productType": {
            "code": "0",
            "name": "NORMAL"
          },
          "mediaType": "Datafil",
          "delivery": "Elektronisk",
          "priceNet": 0,
          "priceVat": 0
        }
      ]
    }
  ]
}

Get products

To get products, you need to use the access_token that you previously obtained.

...

Code Block
curl -s \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer ej577asf-a5k6-42yq-a3a2-fh03hb8cb58c" \
      https://beta-api.ambita.com/kode/v1/products?municipality=9999

Example response

Get order

To get an order, you need to use the access_token that you previously obtained.

...

Code Block
curl -s \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer ej577asf-a5k6-42yq-a3a2-fh03hb8cb58c" \
      https://beta-api.ambita.com/kode/v1/orders/1234567

Example response

Push messages

In order for us to notify your system about events on an order, you need to provide a callback URL, send this to support@ambita.com

...

Status

Description

NEW

This status is the same as an order confirmation email, it confirms that our order system has received the order and is ready to process the order

UPDATED

This status is sent when a new file has arrived and you should get the new file. NB! This status can occur after an order is finished

FINISHED

This status is sent when an order is set to finished, you should check if you have received all the files

CANCELLED

This status is sent when the order is cancelled, you should delete the files that you have received on this order

REFUNDED

This status is sent when the order is refunded, you should delete the files that you have received on this order

Example request body

Get delivered files

Here you can find information about assets in our API

...

Property

Description

name

The name of the file that is uploaded to our system

filename

A descriptive filename that we create based on product name

downloadUrl

The URL to where you can download the file

assetStatus

The status of the asset, see section below

productCategory

The category of the asset, can be used to categorize files or cost, see section below

id

Unique id for each asset

Asset status

Status

Description

OK

The asset is available and can be downloaded

DELETED

The asset is deleted and is no longer available, you should remove the file from your system

Product categories

Available product categories

Product category

PRODUKT_UTEN_KATEGORI

KOMMUNAL_INFORMASJON

PLAN_KART_REGULERING

FERDIGATTEST_OG_MIDLERTIDIG_BRUKSTILLATELSE

File types

Most of the files are PDFs, but we also deliver other file types, these are the most common types:

...