Client API Documentation

View Private API

Getting Started

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

Authentication

The REST service uses Basic Authentication. The client email address and password are used.

Store Endpoint

Get all Stores

GET: /api/store/json/

Example Output
[
   {
      "id":"1",
      "description":"Test Store #1",
      "location":"Hillcrest Corner Shopping Centre,48 Old Main Rd, Hillcrest, 3650",
      "gps_coords":"-29.779689,30.763572",
      "external_id":"AURA_60195",
      "active":"1"
   },
   {
      "id":"2",
      "description":"Test Store #2",
      "location":"Shop 5, Linkhills Shopping Centre, Inanda Road, Waterfall, 3652",
      "gps_coords":"-29.750917,30.814359",
      "external_id":"AURA_60195",
      "active":"1"
   },
   {
      "id":"3",
      "description":"Test Store #3",
      "location":"Shop 202, Kloof Village Mall, Village Road, Kloof",
      "gps_coords":"-29.789998,30.831008",
      "external_id":null,
      "active":"1"
   }
]          
        

Get one Store

GET: /api/store/json/{store_id}

Example Output
{
   "id":"1",
   "description":"Test Store #1",
   "location":"Hillcrest Corner Shopping Centre,48 Old Main Rd, Hillcrest, 3650",
   "gps_coords":"-29.779689,30.763572",
   "external_id":"AURA_60195",
   "active":"1"
}          
        

Driver Endpoint

Get all drivers

GET: /api/driver/json/

Example Output
[
   {
      "id":"1",
      "first_name":"Test",
      "last_name":"Driver 1",
      "email_address":"",
      "password_hash":"202cb962ac59075b964b07152d234b70",
      "external_id":"AURA_123",
      "current_location":null,
      "current_speed":null,
      "current_timestamp":null,
      "current_status":null
   },
   {
      "id":"2",
      "first_name":"Test",
      "last_name":"Driver 2",
      "email_address":"",
      "password_hash":"289dff07669d7a23de0ef88d2f7129e7",
      "external_id":null,
      "current_location":null,
      "current_speed":null,
      "current_timestamp":null,
      "current_status":null
   },
   {
      "id":"3",
      "first_name":"Test",
      "last_name":"Driver 3",
      "email_address":"",
      "password_hash":"d81f9c1be2e08964bf9f24b15f0e4900",
      "external_id":null,
      "current_location":null,
      "current_speed":null,
      "current_timestamp":null,
      "current_status":null
   },
   {
      "id":"5",
      "first_name":"API",
      "last_name":"Insert 1",
      "email_address":"",
      "password_hash":"202cb962ac59075b964b07152d234b70",
      "external_id":"AURA_1",
      "current_location":"-29.7785816,30.749115",
      "current_speed":"",
      "current_timestamp":"2014-08-17 12:37:26",
      "current_status":null
   }
]
      

Get one driver

GET: /api/driver/json/{driverid}

Example Output
{
   "id":"1",
   "first_name":"Test",
   "last_name":"Driver 1",
   "email_address":"",
   "password_hash":"202cb962ac59075b964b07152d234b70",
   "external_id":"AURA_123",
   "current_location":null,
   "current_speed":null,
   "current_timestamp":null,
   "current_status":null
}
        

Get filtered drivers

GET: /api/driver/json/?{field}={value}

Example Output: /api/driver/json?external_id=AURA_123
{      
[
   {
      "id":"1",
      "first_name":"Test",
      "last_name":"Driver 1",
      "email_address":"",
      "password_hash":"202cb962ac59075b964b07152d234b70",
      "external_id":"AURA_123",
      "current_location":null,
      "current_speed":null,
      "current_timestamp":null,
      "current_status":null
   }
]      
        

Add a new driver

POST: /api/driver/json/

Example Input
{
   "first_name":"Test",
   "last_name":"Driver",
   "email_address":"[email protected]",
   "password_hash":"202cb962ac59075b964b07152d234b70",
   "external_id":"driver-1"
}
        
Example Output
{
   "id":"6",
   "first_name":"Test",
   "last_name":"Driver",
   "email_address":"[email protected]",
   "password_hash":"202cb962ac59075b964b07152d234b70",
   "external_id":"driver-1",
   "current_location":null,
   "current_speed":null,
   "current_timestamp":null,
   "current_status":null
}
        

Update driver

POST: /api/driver/json/{driver_id}

Example Input
{
  "last_name":"Driverx"
}
        
Example Output
{
   "id":"6",
   "first_name":"Test",
   "last_name":"Driverx",
   "email_address":"[email protected]",
   "password_hash":"202cb962ac59075b964b07152d234b70",
   "external_id":"driver-1",
   "current_location":null,
   "current_speed":null,
   "current_timestamp":null,
   "current_status":null
}
          


Customer

Get all Customers

GET: /api/customer/json/

Example Output
        [
   {
      "id":"2",
      "first_name":"Test",
      "last_name":"Customer 2",
      "mobile_number":"27837018583",
      "home_number":"",
      "company_name":"Cosoft",
      "address":"18 York Rd, Gillitts",
      "gps_coords":"-29.7975155, 30.7897485",
      "delivery_instructions":"",
      "notes":"",
      "email_address":"[email protected]",
      "external_id":null
   },
   {
      "id":"3",
      "first_name":"Test",
      "last_name":"Customer 3",
      "mobile_number":"",
      "home_number":"",
      "company_name":"",
      "address":"15 Ashley Drive, Gillitts",
      "gps_coords":"-29.785124, 30.803296",
      "delivery_instructions":"",
      "notes":"",
      "email_address":"",
      "external_id":null
   },
   {
      "id":"4",
      "first_name":"Test",
      "last_name":"Customer 4",
      "mobile_number":"",
      "home_number":"",
      "company_name":"",
      "address":"72 Old Main Road, Hillcrest",
      "gps_coords":"-29.772882, 30.762148",
      "delivery_instructions":"",
      "notes":"",
      "email_address":"",
      "external_id":null
   },
   {
      "id":"5",
      "first_name":"Test",
      "last_name":"Customer 5",
      "mobile_number":"",
      "home_number":"",
      "company_name":"",
      "address":"20 Abelia Road, Kloof",
      "gps_coords":"-29.788936, 30.8257564",
      "delivery_instructions":"",
      "notes":"",
      "email_address":"",
      "external_id":null
   }
]

Get One Customer

GET: /api/customer/json/{customer_id}

Example Output
{
   "id":"2",
   "first_name":"Test",
   "last_name":"Customer 2",
   "mobile_number":"27837018583",
   "home_number":"",
   "company_name":"Cosoft",
   "address":"18 York Rd, Gillitts",
   "gps_coords":"-29.7975155, 30.7897485",
   "delivery_instructions":"",
   "notes":"",
   "email_address":"[email protected]",
   "external_id":null
}
        

Get Filtered Customers

GET: /api/customer/json/?{field}={value}

Example Output: /api/customer/json/?mobile_number=278312343567
      
[
   {
      "id":"2",
      "first_name":"Test",
      "last_name":"Customer 2",
      "mobile_number":"278312343567",
      "home_number":"",
      "company_name":"Cosoft",
      "address":"18 York Rd, Gillitts",
      "gps_coords":"-29.7975155, 30.7897485",
      "delivery_instructions":"",
      "notes":"",
      "email_address":"[email protected]",
      "external_id":null
   }
]
        

Add a new Customer

POST: /api/customer/json/

Example Input
{
  "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": "[email protected]",
  "external_id":"customer-2"
}
        
Example Output
{
   "id":"6",
   "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":"[email protected]",
   "external_id":"customer-2"
}        

Delivery Endpoint

Get all deliveries

GET: /api/delivery/json/

Example Output
[
   {
      "id":"1",
      "client_id":"1",
      "customer_id":"1",
      "store_id":"1",
      "driver_id":"5",
      "delivery_date":"2014-06-08",
      "delivery_time":"23:02:20",
      "delivery_value":"100",
      "delivery_details":"1 x Burger\n1 x Chips",
      "timestamp_added":"2014-06-08 11:02:35",
      "timestamp_dispatched":"2014-09-19 15:33:11",
      "timestamp_delivered":"2014-09-19 15:33:18",
      "status":"3",
      "external_id":null,
      "delivery_zone":"A1",
      "source":"AURA"
   },
   {
      "id":"2",
      "client_id":"1",
      "customer_id":"2",
      "store_id":"1",
      "driver_id":"5",
      "delivery_date":"2014-06-08",
      "delivery_time":"23:02:47",
      "delivery_value":"200",
      "delivery_details":"2 x Pizza",
      "timestamp_added":"2014-06-08 11:03:02",
      "timestamp_dispatched":"2014-06-08 23:06:30",
      "timestamp_delivered":null,
      "status":"1",
      "external_id":null,
      "delivery_zone":"B1",
      "source":"AURA"
   },
   {
      "id":"3",
      "client_id":"1",
      "customer_id":"3",
      "store_id":"2",
      "driver_id":"5",
      "delivery_date":"2014-06-08",
      "delivery_time":"23:03:09",
      "delivery_value":"150",
      "delivery_details":"1 x Large Pizza",
      "timestamp_added":"2014-06-08 11:03:31",
      "timestamp_dispatched":"2014-06-08 23:06:30",
      "timestamp_delivered":"2014-06-08 23:06:42",
      "status":"1",
      "external_id":null,
      "delivery_zone":"A1",
      "source":"AURA"
   },
   {
      "id":"4",
      "client_id":"1",
      "customer_id":"5",
      "store_id":"3",
      "driver_id":"-1",
      "delivery_date":"2014-06-08",
      "delivery_time":"23:04:49",
      "delivery_value":"80",
      "delivery_details":"1 x Pizza",
      "timestamp_added":"2014-06-08 11:05:02",
      "timestamp_dispatched":null,
      "timestamp_delivered":null,
      "status":"0",
      "external_id":null,
      "delivery_zone":"C3",
      "source":"AURA"
   },
   {
      "id":"5",
      "client_id":"1",
      "customer_id":"4",
      "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\n1 x Large Pizza",
      "timestamp_added":"2014-06-08 11:05:30",
      "timestamp_dispatched":null,
      "timestamp_delivered":null,
      "status":"0",
      "external_id":null,
      "delivery_zone":"D1",
      "source":"AURA"
   },
   {
      "id":"7",
      "client_id":"1",
      "customer_id":"4",
      "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-21 09:29:38",
      "timestamp_dispatched":null,
      "timestamp_delivered":null,
      "status":"0",
      "external_id":"Order-123",
      "delivery_zone":"Some Map R",
      "source":"Your Source Type"
   }
]
        

Get one delivery

GET: /api/delivery/json/{delivery_id}

Example Output: /api/delivery/json/7
{
   "id":"7",
   "client_id":"1",
   "customer_id":"4",
   "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-21 09:29:38",
   "timestamp_dispatched":null,
   "timestamp_delivered":null,
   "status":"0",
   "external_id":"Order-123",
   "delivery_zone":"Some Map R",
   "source":"Your Source Type"
}
        

Get filtered deliveries

GET: /api/delivery/json/?{field}={value}&{another_field}={another_value}

Example Output: /api/delivery/json/?status=0
[
   {
      "id":"4",
      "client_id":"1",
      "customer_id":"5",
      "store_id":"3",
      "driver_id":"-1",
      "delivery_date":"2014-06-08",
      "delivery_time":"23:04:49",
      "delivery_value":"80",
      "delivery_details":"1 x Pizza",
      "timestamp_added":"2014-06-08 11:05:02",
      "timestamp_dispatched":null,
      "timestamp_delivered":null,
      "status":"0",
      "external_id":null,
      "delivery_zone":"C3",
      "source":"AURA"
   },
   {
      "id":"5",
      "client_id":"1",
      "customer_id":"4",
      "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\n1 x Large Pizza",
      "timestamp_added":"2014-06-08 11:05:30",
      "timestamp_dispatched":null,
      "timestamp_delivered":null,
      "status":"0",
      "external_id":null,
      "delivery_zone":"D1",
      "source":"AURA"
   },
   {
      "id":"7",
      "client_id":"1",
      "customer_id":"4",
      "store_id":"2",
      "driver_id":"-1",
      "delivery_date":"2014-06-08",
      "delivery_time":"23:05:08",
      "delivery_value":"150",
      "delivery_details":"1 x Small Pizza \n 1 x Large Pizza \n 1 x Medium Pizza",
      "timestamp_added":"2014-09-21 09:29:38",
      "timestamp_dispatched":null,
      "timestamp_delivered":null,
      "status":"0",
      "external_id":"Order-123",
      "delivery_zone":"Some Map R",
      "source":"Your Source Type"
   }
]
        

Add Delivery

POST: /api/delivery/json/

Example Input: Specify a customer_id
{
   "customer_id":"4",
   "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":"7",
   "client_id":"1",
   "customer_id":"4",
   "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-21 09:29:38",
   "timestamp_dispatched":null,
   "timestamp_delivered":null,
   "status":"0",
   "external_id":"Order-123",
   "delivery_zone":"Some Map R",
   "source":"Your Source Type"
}
        
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":"[email protected]",
        "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"
}
        

Update Delivery

POST: /api/driver/json/{delivery_id}

Example Input
{
   "delivery_value":"150",
   "delivery_details":"1 x Small Pizza \n 1 x Large Pizza \n 1 x Medium Pizza"
}
        
Example Output
{
   "id":"7",
   "client_id":"1",
   "customer_id":"4",
   "store_id":"2",
   "driver_id":"-1",
   "delivery_date":"2014-06-08",
   "delivery_time":"23:05:08",
   "delivery_value":"150",
   "delivery_details":"1 x Small Pizza \n 1 x Large Pizza \n 1 x Medium Pizza",
   "timestamp_added":"2014-09-21 09:29:38",
   "timestamp_dispatched":null,
   "timestamp_delivered":null,
   "status":"0",
   "external_id":"Order-123",
   "delivery_zone":"Some Map R",
   "source":"Your Source Type"
}