doorhub logo doorhub

Integration Details Overview

Learn the company integration in details. We have described all the integration steps in details here.


Registration

First of all you have to signup as a store into the Doorhub system. Register.

Once your company is registered, it may take 24-48 hours to activate the account. Please contact us to activate it immediately. Once your account is activated, you can login to the dashboard of our test environment (https://test.doorhub.io/dashboard). Test environment is used only for testing and integration purposes. The dashboard is useful for the integration as here you can see the placed orders, order current statuses etc.

Once you are logged in you’ll have 3 different options for registration you can create (Warehouse / Store / Hub). To offer your customers with sameday deliveries you have to create a (Warehouse).

Test environment

Dashboard of the test environment provides helpful features targets for the testing of the system and integration. When you use the TEST api key the response of the API might be a mock of the same format as it is on the live server.

API Keys

Once you are into the dashboard, you can see the TEST api key. while doing the integration you should send this API key for all the requests.

Key format: Test api key starts with co_test_*

You LIVE api key will be activated once the integration is complete and agreed by both parties (Doorhub and Company). Live api key should be used for the production environment for placing the real orders.

Key format: Live api key starts with co_live_*

{info} Even thought you are using TEST key or LIVE key, you should always send the api request to our LIVE environment (https://doorhub.io).

Get warehouses [check the api]

Using this api service company can get all the delivery regions that Doorhub supports for them (the company).

{primary} Example of a request

curl -X GET -G "https://doorhub.io/api/sameday/v1/company/warehouse" 
    -H "Authorization: Bearer {api-key}" 
    -H "Api-Version: v1"

{success} Example of response [200]

{
    "success": true,
    "message": "Warehouses list",
    "data": {
           "company": {
               "id": 1,
               "name": "DH Restaurant"
           },
           "warehouse": [
               {
                   "warehouseId": 172,
                   "warehouseName": "Kastrup Warehouse",
                   "pickupAddress": "Kastrup, Denmark",
                   "city": "Copenhagen",
                   "distribution": [
                       {
                           "id": 1,
                           "orderBefore": "10:00:00",
                           "starTime": "12:00:00",
                           "endTime": "17:00:00"
                       },
                       {
                           "id": 2,
                           "orderBefore": "14:00:00",
                           "starTime": "19:00:00",
                           "endTime": "20:00:00"
                       }
                   ]
               }
           ]
       }
}

Order

Validate customer address [check the api]

To validate customer address you will use this service.

{primary} Example of a request

curl -X POST "https://doorhub.io/api/sameday/v1/warehouse/customer/address/check" 
    -H "Authorization: Bearer {api-key}" 
    -H "Api-Version: v1" 
    -H "Content-Type: application/json" 
    -d '{
        "dropOffAddress" : "Amager, Copenhagen"
        }'


Body Parameters
Parameters Type Status Description
dropOffAddress string required The google like address of the order where it should be delivered. Example: Heimdalsgade 42, 2200 København N

Validate customer response:

200 - When the address is valid
404 - When the address is not valid
400 - When the address parameter is not valid

{success} Example of a response [200]

when the address is validate, it will response with http code: 200

{
    "success": true,
    "message": "Address support status!",
    "data": {
        "status": true,
        "region_id": 2,
        "city": "Copenhagen"
    }
}

when the address is not validate, it will response with http code: 404

{
    "success": true,
    "message": "Address support status!",
    "data": {
        "status": false,
        "region_id": null,
        "city": null
    }
}

when the address parameter is not set correctly, it will response with http code: 400

{
     "success": false,
    "message": "Address not set!",
    "error": ""
}

Place an order [check the api]

To place an order to Doorhub as warehouse, you will use this checkout service.

{primary} Example of a request

curl -X POST "https://doorhub.io/api/sameday/v1/warehouse/order/checkout" 
    -H "Authorization: Bearer {api-key}" 
    -H "Api-Version: v1" 
    -H "Content-Type: application/json" 
    -d '{
       "dropOffAddress" : "Amager, Copenhagen",
        "customerName" : "Ahmed",
        "customerPhone" : "52172329",
        "productSize" : "medium",
        "customerFloor" : "11",
        "companyId" : 1,
        "warehouseId" : 172,
        "description" : "this is test",
        "deliveryId" : "1000022",
        "dateForDropOff" : "2019-07-09",
        "distributionId" : 2
        }'


Body Parameters
Parameters Type Status Description
companyId integer nullable if warehouseId is set companyId is for the reference of the company.
warehouseId integer nullable if company is set warehouseId is for the reference of the Warehouse. (companyId and warehouseId both can not be null)
distributionId integer nullable preferred delivery time
deliveryId string nullable Delivery order Id in the company system, this is for the reference of the order.
pickupAddress string required The google like address of the order pickup location, Example: Toftegårds Allé 49, 2500 København
dropOffAddress string required The google like address of the order where it should be delivered. Example: Heimdalsgade 42, 2200 København N
customerFloor string required customer apartment floor
dateForDropOff Date required Drop off time
customerName string required Name of the customer
customerPhone string required Phone numner of the customer. Example: 91722653
customerFloor string optional Floor numner of the customer. Example: 1.Tv
productSize string required The size of the products, it can be [small ,medium, big].
Our Bag size is W: 16 x L: 16 x H: 18 "Inch".
For Food category:
0-6 items AND price <> 0 - 550 dkk: small,
0-9 items AND price <> 551 - 999 dkk: medium,
10 > items AND price > 1000 dkk: big
description string optinal Any instruction / comments about the order.

Checkout response:

201 - When the order it created
200 - Order maybe already exists and confirmed
200 - Order maybe already exists and needs to confirm using confirm API
200 - Order maybe can't place in time (for scheduled order) and Doorhub sends best possible suggestion time
400 - Any bad request, like the zone is not supported by Doorhub etc.
422 - If any required request field is missing / any error

{success} Example of a response [201]

when the order is created, it will response with http code: 201

{
    "success": true,
    "message": "Order processed successfully",
    "data": {
       "orderRef": "#172-0001",
       "serviceName": "Doorhub delivery",
       "priceUnit": "DKK",
       "order": {
           "bundleRef": "Kh173_1",
           "customerName": "Ahmed",
           "customerPhone": "52172329",
           "customerFloor": "11",
           "deliveryId": 1000022,
           "sellerName": "Kastrup Warehouse",
           "pickupAddress": "Kastrup, Denmark",
           "dropOffAddress": "Amager, Copenhagen",
           "deliveryCharge": 49,
           "productSize": "medium",
           "confirmed": true,
           "deliveryDate": "2019-07-05",
           "deliveryTime": "12:00:00 to 17:00:00",
           "description": "Test order",
           "status": "Waiting"
       }
    }
}

{danger} Example of a response [422]

if any arguments is missing or preferred date and time if not satisfied

{
    "success": false,
    "message": "Order can not be placed! please check your drop off date and time!",
    "error": {
        "dropOffAddress": "Ryparken 35, Copenhagen",
        "customerName": "Ahmed",
        "customerPhone": "52172329",
        "productSize": "medium",
        "customerFloor": "11",
        "warehouseId": 172,
        "description": "this is test",
        "deliveryId": "1000011",
        "dateForDropOff": "2019-06-2",
        "distributionId": 1
    }
}

{warning} Example of response [200]

Cancel an order [check the api]

This service is used to cancel an order. Any order maybe canceled after it is placed to the Doorhub system.

When order can be cancel?

  • If there is no driver assigned to the order.
  • If the pickup time is not less than 10 minutes.

Which cases the order can't be cancel?

  • If the order is already picked up by the driver
  • If the order is already delivered to the customer

An order maybe canceled but still might charged as if the pickup time less than 10 minutes

{primary} Example of request

curl -X PATCH "https://doorhub.io/api/sameday/v1/warehouse/order/cancel" 
    -H "Authorization: Bearer {api-key}" 
    -H "Api-Version: v1"
    -d '{
            "orderRef" : "#172-0006"
        }'

{success} Example of response [200]

{
    "success": true,
    "message": "Order is canceled!",
    "data": {
        "orderRef": "#174-0006"
    }
}

{danger} Example of response [400]

if the order is not valid

{
    "success": false,
    "message": "Order is not found!",
    "error": "#174-00062 is invalid, Please check your order reference!"
}

{danger} Example of response [400]

{
    "success": true,
    "message": "Order can not be canceled!",
    "data": {
        "orderRef": "#174-0004"
    }
}

View an order [check the api]

This service is used to view an existing order details.

{primary} Example of request

curl -X GET -G "https://doorhub.io/api/sameday/v1/order/{orderRef}/show" 
    -H "Authorization: Bearer {api-key}" 
    -H "Api-Version: v1"

{success} Example of response [200]

{
     "success": true,
     "message": "",
     "data": {
        "orderRef": "#172-0001",
        "serviceName": "Doorhub delivery",
        "priceUnit": "DKK",
        "order": {
            "bundleRef": "Kh173_1",
            "customerName": "Ahmed",
            "customerPhone": "52172329",
            "customerFloor": "11",
            "deliveryId": 1000022,
            "sellerName": "Kastrup Warehouse",
            "pickupAddress": "Kastrup, Denmark",
            "dropOffAddress": "Amager, Copenhagen",
            "deliveryCharge": 49,
            "productSize": "medium",
            "confirmed": true,
            "deliveryDate": "2019-07-05",
            "deliveryTime": "12:00:00 to 17:00:00",
            "description": "Test order",
            "status": "Waiting"
        }
     }
}