Private API Documentation

View Client API

Introduction

The private API is there to integrate with Deliveree on a high level, whereas the Client API only has access to a client's data.

Getting Started

The service makes a REST API available. JSON is used for data exchange.

Server Details

The Private API is available at http://api.deliveree.co.za/

Authentication

The REST service uses Basic Authentication. The username/password will be supplied.

Event Callback Subscriptions

About

This allows you to register a HTTP callback when an event occurs.

Add Callback Subscription to AURA event

POST: /subs/aura/add

Example Input
{
    "storeid": 60009,
    "invoicenum":705945,
    "callback":"http://username:password@server/path/to/callback"
}        
Example Output
{
  "ok": true,
  "id": "60009_705945",
  "rev": "1-fed7829fb3127ca409c226600186fa11"
}          
          

Remove a Callback Subscription to AURA event

POST: /subs/aura/remove

Example Input
{
    "storeid": 60009,
    "invoicenum":705945,
    "callback":"http://username:password@server/path/to/callback"
}          
Example Output
         
          

Delivery

View Delivery

GET: /rest/delivery/{deliveryid}

Example Output
{
    "id":"9",
    "client_id":"1",
    "customer_id":"7",
    "store_id":"2",
    "driver_id":"-1",
    "delivery_date":"2014-06-08",
    "delivery_time":"23:05:08",
    "delivery_value":"120",
    "delivery_details":"1 x Small Pizza \n 1 x Large Pizza",
    "timestamp_added":"2014-09-25 10:56:59",
    "timestamp_dispatched":null,
    "timestamp_delivered":null,
    "status":"0",
    "external_id":"Order-123",
    "delivery_zone":"Some Map R",
    "source":"Your Source Type"
}
        

Add a new Delivery

POST: /rest/delivery/add

Example Input: Specify a customer object
{
    "customer":{
        "first_name":"Another",
        "last_name":"Customer",
        "mobile_number":"0811234567",
        "home_number":"0311234567",
        "company_name":"Test Company",
        "address":"1 Old Main Road, Hillcrest",
        "gps_coords":"-29.7975155, 30.7897485",
        "delivery_instructions":"Hoot at gate",
        "notes":"",
        "email_address":"another.customer@example.com",
        "external_id":"customer-2"
    },
    "customer_id":-1,
    "store_id":"2",
    "driver_id":"-1",
    "delivery_date":"2014-06-08",
    "delivery_time":"23:05:08",
    "delivery_value":"120",
    "delivery_details":"1 x Small Pizza \n 1 x Large Pizza",
    "external_id":"Order-123",
    "delivery_zone":"Some Map Ref",
    "source":"Your Source Type"
}
        
Example Output
{
    "id":"9",
    "client_id":"1",
    "customer_id":"7",
    "store_id":"2",
    "driver_id":"-1",
    "delivery_date":"2014-06-08",
    "delivery_time":"23:05:08",
    "delivery_value":"120",
    "delivery_details":"1 x Small Pizza \n 1 x Large Pizza",
    "timestamp_added":"2014-09-25 10:56:59",
    "timestamp_dispatched":null,
    "timestamp_delivered":null,
    "status":"0",
    "external_id":"Order-123",
    "delivery_zone":"Some Map R",
    "source":"Your Source Type"
}
        

Get an AURA Delivery

GET: /rest/aura/delivery/view/{storeid}/{invoicenum}

Example Output
[
  {
    "id": 1,
    "client_id": 1,
    "customer_id": 2,
    "store_id": 1,
    "driver_id": 1,
    "delivery_date": "2015-09-22T22:00:00.000Z",
    "delivery_time": "17:59:40",
    "delivery_value": 109.9,
    "delivery_details": "0.5 x **HALF** Meaty Triple Decker\r\n0.5 x **HALF** Chicken Triple Decker\r\n0 x PAID ODER...\r\n",
    "timestamp_added": "2015-09-23T15:59:50.000Z",
    "timestamp_dispatched": "2015-09-23T16:34:24.000Z",
    "timestamp_delivered": null,
    "status": 2,
    "external_id": "aura-705945",
    "order_num": "127",
    "delivery_zone": "ONLINE",
    "source": "AURA-Invoicing",
    "timestamp_placed": "2015-09-23T15:59:50.000Z",
    "timestamp_due": "2015-09-23T16:31:40.000Z",
    "timestamp_assigned": "2015-09-23T16:33:25.000Z",
    "customer_first_name": "Bob",
    "customer_last_name": "Builder",
    "customer_phone": "",
    "customer_gps_coords": "-26.2913653, 28.0906806",
    "store_desc": "Test Store",
    "store_external_id": "AURA_60009",
    "driver_first_name": "Speedy",
    "driver_last_name": "Racer",
    "driver_status": -1,
    "driver_last_position": "-26.322285000000004,28.0924883",
    "driver_last_updated": "2015-09-23T17:08:40.000Z",
    "status_desc": "In Progress",
    "travel_time": "00:07:41",
    "duration": 461,
    "seconds_since_placed": 354213,
    "seconds_until_due": -352303,
    "seconds_to_delver": 461,
    "seconds_until_eta": -351678,
    "seconds_left_to_complete": -352764,
    "seconds_delivered_before_due": 0,
    "display_num": "127",
    "seconds_delivered_before_eta": 0,
    "deliverygroup_id": null,
    "deliverygroup_position": null,
    "route_id": 1,
    "route_position": 1
  }
]         
          

Delivery Status

Get the different possible Delivery Status values

GET: /rest/deliverystatus

Example Output
[
  {
    "id": 0,
    "description": "Unassigned"
  },
  {
    "id": 1,
    "description": "Undispatched"
  },
  {
    "id": 2,
    "description": "In Progress"
  },
  {
    "id": 3,
    "description": "Delivered"
  },
  {
    "id": 91,
    "description": "Hoax"
  },
  {
    "id": 92,
    "description": "Could not deliver"
  },
  {
    "id": 93,
    "description": "Converted to Collect"
  },
  {
    "id": 94,
    "description": "Order Cancelled"
  }
]