Delivery

This is the documentation for version v1 of the API. Last update on Jul 1, 2021.

Base URL
https://api.emporix.io/delivery-v2

Configuration

Get configuration for given site and tenant

Get configuration for given site and tenant.

There are two delivery providers supported by service: ONFLEET and VELOCE.
If VELOCE provider is set for a particular site and tenant, additional object field VeloceConfiguration is returned:

{
  "veloceConfiguration": {
    "veloceCustomerNumber": "12345",
     "format": "Veloce merchant identificator",
     "orderType": Veloce order type
  }
}
Headers
  • authorization Required / string

    Bearer token

Path parameters
  • tenant Required / string
Query parameters
  • siteCode Required / string
Responses
  • 200 object

    Resource successfully retrieved.

    • id string
    • siteCode string
    • deliveryProvider string

      Values are VELOCE and ONFLEET.

    • createdAt string(date-time)
    • modifiedAt string(date-time)
  • 404

    Delivery configuration with requested parameters does not exist in the database.

GET /{tenant}/configuration
$ curl \
 -X GET https://api.emporix.io/delivery-v2/{tenant}/configuration?siteCode=string \
 -H "authorization: string"
Response example (200)
[
  {
    "id": "main",
    "siteCode": "main",
    "deliveryProvider": "VELOCE",
    "veloceConfiguration": {
      "veloceCustomerNumber": "12345",
      "format": "Veloce merchant identificator",
      "orderType": "Veloce order type"
    },
    "createdAt": "2020-07-22T12:28:53.48",
    "modifiedAt": "2020-07-22T12:28:53.48"
  }
]
Response example (404)
{
  "message": "Page Not Found",
  "code": 404
}

Update configuration for given site and tenant

Update configuration for given site and tenant.

If a delivery provider is to be set to ONFLEET, the credential object should contain apiKey field.
Example request payload to set ONFLEET as a delivery provider can look like on below example:

{
  {
    "siteCode": "8450",
    "deliveryProvider": "ONFLEET",
    "credentials": {
      "apiKey": "string"
    },
  }
}

If a delivery provider is to be set to VELOCE, the credential object should contain token field.
Example request payload to set VELOCE as a delivery provider can look like on below example:

{
  {
    "siteCode": "8450",
    "deliveryProvider": "VELOCE",
    "veloceCustomerNumber": "222222",
    "credentials": {
      "token": "string"
    },
    "veloceConfiguration": {
    "veloceCustomerNumber": "12345",
     "format": "Veloce merchant identificator",
      "orderType": Veloce order type
      }
    }
}
Headers
  • authorization Required / string

    Bearer token

Path parameters
  • tenant Required / string
Body
  • id string
  • deliveryProvider string

    Values are VELOCE and ONFLEET.

  • veloceConfiguration object
    • veloceCustomerNumber string
    • format string
    • orderType number
  • credentials object
    • apiKey string
    • token string
Responses
  • 200 object

    Delivery configuration modified successfully.

    • matchedCount number
    • modifiedCount number
  • 500

    Not all required body parameters were provided.

PUT /{tenant}/configuration
$ curl \
 -X PUT https://api.emporix.io/delivery-v2/{tenant}/configuration \
 -H "Content-Type: application/json" \
 -H "authorization: string" \
 -d '{"id":"8450","deliveryProvider":"VELOCE","veloceCustomerNumber":"3333333","credentials":{"token":"string"},"veloceConfiguration":{"veloceCustomerNumber":"12345","format":"Veloce merchant identificator","orderType":"Veloce order type"}}'
Request payload example
# Headers
authorization: string

# Payload
{
  "id": "8450",
  "deliveryProvider": "VELOCE",
  "veloceCustomerNumber": "3333333",
  "credentials": {
    "token": "string"
  },
  "veloceConfiguration": {
    "veloceCustomerNumber": "12345",
    "format": "Veloce merchant identificator",
    "orderType": "Veloce order type"
  }
}
Response example (200)
[
  {
    "matchedCount": 1,
    "modifiedCount": 1
  }
]
Response example (500)
{
  "message": "Internal Server Error: value can not be null",
  "code": 500
}

Create new configuration for given site and tenant

Create new configuration for given site and tenant.

If a delivery provider is to be set to ONFLEET, the credential object should contain apiKey field.
Example request payload to set ONFLEET as a delivery provider can look like on below example:

{
  {
    "siteCode": "8450",
    "deliveryProvider": "ONFLEET",
    "credentials": {
      "apiKey": "string"
    },
  }
}

If a delivery provider is to be set to VELOCE, the credential object should contain token field.
Example request payload to set VELOCE as a delivery provider can look like on below example:

{
  {
    "siteCode": "8450",
    "deliveryProvider": "VELOCE",
    "veloceCustomerNumber": "222222",
    "credentials": {
      "token": "string"
    },
    "veloceConfiguration": {
    "veloceCustomerNumber": "12345",
    "format": "Veloce merchant identificator",
    "orderType": Veloce order Type
      }
    }
}
Headers
  • authorization Required / string

    Bearer token

Path parameters
  • tenant Required / string
Body
  • siteCode string
  • deliveryProvider string

    Values are VELOCE and ONFLEET.

  • veloceConfiguration object
    • veloceCustomerNumber string
    • format string
    • orderType number
  • credentials object
    • apiKey string
    • token string
Responses
  • 200 object

    Delivery configuration added successfully.

    • value string
    • bsonType string
    • document boolean
    • string boolean
    • int32 boolean
    • int64 boolean
    • decimal128 boolean
    • objectId boolean
    • dbpointer boolean
    • timestamp boolean
    • dateTime boolean
    • symbol boolean
    • regularExpression boolean
    • javaScript boolean
    • javaScriptWithScope boolean
    • boolean boolean
    • number boolean
    • double boolean
    • binary boolean
    • array boolean
    • boolean
  • 500

    Delivery configuration already exists for this siteCode.

POST /{tenant}/configuration
$ curl \
 -X POST https://api.emporix.io/delivery-v2/{tenant}/configuration \
 -H "Content-Type: application/json" \
 -H "authorization: string" \
 -d '{"siteCode":"8450","deliveryProvider":"VELOCE","veloceCustomerNumber":"222222","credentials":{"token":"string"},"veloceConfiguration":{"veloceCustomerNumber":"12345","format":"Veloce merchant identificator","orderType":"Veloce order type"}}'
Request payload example
# Headers
authorization: string

# Payload
{
  "siteCode": "8450",
  "deliveryProvider": "VELOCE",
  "veloceCustomerNumber": "222222",
  "credentials": {
    "token": "string"
  },
  "veloceConfiguration": {
    "veloceCustomerNumber": "12345",
    "format": "Veloce merchant identificator",
    "orderType": "Veloce order type"
  }
}
Response example (200)
[
  {
    "insertedId": {
      "value": "87123",
      "bsonType": "STRING",
      "document": false,
      "string": true,
      "int32": false,
      "int64": false,
      "decimal128": false,
      "objectId": false,
      "dbpointer": false,
      "timestamp": false,
      "dateTime": false,
      "symbol": false,
      "regularExpression": false,
      "javaScript": false,
      "javaScriptWithScope": false,
      "boolean": false,
      "number": false,
      "double": false,
      "binary": false,
      "array": false,
      "null": false
    }
  }
]
Response example (500)
{
  "message": "Internal Server Error: E11000 duplicate key error collection: delivery.saastest2--configuration index: _id_ dup key: { _id: \"87123\" }",
  "code": 500
}

Delete configuration for given site and tenant

Delete configuration for given site and tenant

Headers
  • authorization Required / string

    Bearer token

Path parameters
  • tenant Required / string
Query parameters
  • siteCode Required / string
Responses
  • 200 object

    Resource successfully deleted.

    • deletedCount number
  • 404

    Delivery configuration with requested parameters does not exist in the database.

DELETE /{tenant}/configuration
$ curl \
 -X DELETE https://api.emporix.io/delivery-v2/{tenant}/configuration?siteCode=string \
 -H "authorization: string"
Response example (200)
[
  {
    "deletedCount": 1
  }
]
Response example (404)
{
  "message": "Page Not Found",
  "code": 404
}

Order

Get orders for given site and tenant

Get orders for given site and tenant

Headers
  • authorization Required / string

    Bearer token

Path parameters
  • tenant Required / string
Query parameters
  • siteCode Required / string
Responses
  • 200 object

    Resource successfully retrieved.

    • id string
    • siteCode string
    • task object
      • taskId string
      • trackingURL string
      • deliveryProvider string

        Values are VELOCE and ONFLEET.

    • taskId string
    • contactPhone string
    • orderStatus string

      Values are IN_CHECKOUT, CREATED, CONFIRMED, DECLINED, SHIPPED, and COMPLETED.

    • orderNumber string
    • deliveryTime object
      • deliveryDate string(date)
      • deliveryTimeFrom string(time)
      • deliveryTimeTo string(time)
      • deliveryCosts number
      • pickupSettings string
    • pickup boolean
    • pickupAddress object
      • id string
      • street string
      • streetNumber string
      • city string
      • zipCode string
      • companyName string
      • country string
      • addressName string
      • description string
      • addressTag string
    • shippingAddress object
      • contactName string
      • companyName string
      • street string
      • streetNumber string
      • streetAppendix string
      • extraLine1 string
      • extraLine2 string
      • extraLine3 string
      • extraLine4 string
      • zipCode string
      • city string
      • country string
      • state string
      • contactPhone string
GET /{tenant}/order
$ curl \
 -X GET https://api.emporix.io/delivery-v2/{tenant}/order?siteCode=string \
 -H "authorization: string"
Response example (200)
[
  {
    "id": "MPITO1009",
    "siteCode": "main",
    "contactPhone": "+48519374777",
    "orderStatus": "CREATED",
    "orderNumber": "MPITO1009",
    "deliveryTime": {
      "deliveryDate": "2020-12-05",
      "deliveryTimeFrom": "10:00:00",
      "deliveryTimeTo": "12:00:00",
      "deliveryCosts": 20,
      "pickupSettings": "Fabrikstr. 5.",
      "completeAfter": 1607162400000,
      "completeBefore": 1607169600000
    },
    "pickup": false,
    "pickupAddress": {
      "id": "Pickup 1",
      "street": "Fabrikstr",
      "streetNumber": "5.",
      "city": "Cham",
      "zipCode": "6033",
      "companyName": "Test AG",
      "country": "DE",
      "addressName": "Fabrikstr. 5.",
      "description": "test description for multiple pickup points",
      "addressTag": "pickupAddress"
    },
    "shippingAddress": {
      "contactName": "John Doe",
      "street": "Fritz-Elsas-Straße",
      "streetNumber": "20",
      "zipCode": "70173",
      "city": "Stuttgart-Mitte",
      "country": "DE"
    }
  },
  {
    "id": "MPITO1010",
    "siteCode": "main",
    "contactPhone": "+48519374777",
    "orderStatus": "CREATED",
    "orderNumber": "MPITO1010",
    "pickup": false,
    "shippingAddress": {
      "contactName": "John Doe",
      "street": "Fritz-Elsas-Straße",
      "streetNumber": "20",
      "zipCode": "70173",
      "city": "Stuttgart-Mitte",
      "country": "DE"
    }
  }
]

Planroute

Push given orders to delivery provider for the given tenant

Push given orders to delivery provider for the given tenant. In case of an unsuccesful route planning for given order (eg. due to invalid address) an email to the Merchant will be send.

Headers
  • authorization Required / string

    Bearer token

Path parameters
  • tenant Required / string
Body
  • orderStatus string

    Values are IN_CHECKOUT, CREATED, CONFIRMED, DECLINED, SHIPPED, and COMPLETED.

  • siteCode string
  • orderIds array[string]
Responses
  • 200 object

    Route planning executed. Returned body only for unsuccessfully planned orders (QAC6GQEF in this example). Returned empty body for successfully planned orders (B7016709).

    • orderId string
    • deliveryProvider string
    • errorMessage string
POST /{tenant}/planRoute
$ curl \
 -X POST https://api.emporix.io/delivery-v2/{tenant}/planRoute \
 -H "Content-Type: application/json" \
 -H "authorization: string" \
 -d '{"orderStatus":"CREATED","siteCode":"main","orderIds":["B7016709","QAC6GQEF"]}'
Request payload example
# Headers
authorization: string

# Payload
{
  "orderStatus": "CREATED",
  "siteCode": "main",
  "orderIds": [
    "B7016709",
    "QAC6GQEF"
  ]
}
Response example (200)
[
  {
    "orderId": "QAC6GQEF",
    "deliveryProvider": "ONFLEET",
    "errorMessage": "completeBefore must not be before creation time"
  }
]

Root

Get order by given orderId and tenant

Get order by given orderId and tenant

Headers
  • authorization Required / string

    Bearer token

Path parameters
  • tenant Required / string
  • orderId Required / string
Responses
  • 200 object

    Resource successfully retrieved.

    • id string
    • siteCode string
    • task object
      • taskId string
      • trackingURL string
      • deliveryProvider string

        Values are VELOCE and ONFLEET.

    • taskId string
    • contactPhone string
    • orderStatus string

      Values are IN_CHECKOUT, CREATED, CONFIRMED, DECLINED, SHIPPED, and COMPLETED.

    • orderNumber string
    • deliveryTime object
      • deliveryDate string(date)
      • deliveryTimeFrom string(time)
      • deliveryTimeTo string(time)
      • deliveryCosts number
      • pickupSettings string
    • pickup boolean
    • pickupAddress object
      • id string
      • street string
      • streetNumber string
      • city string
      • zipCode string
      • companyName string
      • country string
      • addressName string
      • description string
      • addressTag string
    • shippingAddress object
      • contactName string
      • companyName string
      • street string
      • streetNumber string
      • streetAppendix string
      • extraLine1 string
      • extraLine2 string
      • extraLine3 string
      • extraLine4 string
      • zipCode string
      • city string
      • country string
      • state string
      • contactPhone string
GET /{tenant}/order/{orderId}
$ curl \
 -X GET https://api.emporix.io/delivery-v2/{tenant}/order/{orderId} \
 -H "authorization: string"
Response example (200)
[
  {
    "id": "QAC6GQEF",
    "siteCode": "main",
    "orderStatus": "CREATED",
    "orderNumber": "B7012191",
    "deliveryTime": {
      "deliveryDate": "2020-07-28",
      "deliveryTimeFrom": "15:00:00",
      "deliveryTimeTo": "22:00:00",
      "deliveryCosts": 20,
      "pickupSettings": "Fabrikstr. 5.",
      "completeAfter": 1595948400000,
      "completeBefore": 1595973600000
    },
    "pickup": false,
    "pickupAddress": {
      "id": "Pickup 1",
      "street": "Fabrikstr",
      "streetNumber": "5.",
      "city": "Cham",
      "zipCode": "6033",
      "companyName": "Test AG",
      "country": "DE",
      "addressName": "Fabrikstr. 5.",
      "description": "test description for multiple pickup points",
      "addressTag": "pickupAddress"
    },
    "shippingAddress": {
      "contactName": "Nazim Mohammed",
      "street": "Calwer Str",
      "streetNumber": "23",
      "zipCode": "70173",
      "city": "Stuttgart-Mitte",
      "country": "DE",
      "contactPhone": "+48 519374777"
    }
  }
]