Keystone Driver App REST API: Difference between revisions

From KeystoneIntranet
Jump to navigation Jump to search
 
m (1 revision imported)
 
(No difference)

Latest revision as of 12:58, 14 July 2023

Overview

The Keystone REST Server exposes a REST API which is used by the Keystone Driver App to communicate with the Keystone Application Server.

The Keystone Driver App, aka Keystone On-Delivery, is accessed from Keystone Cloud applications.

See: Keystone_REST_Server_(KServer) for more on KServer.

Example URIs:

http://127.0.0.1:8211/rest/ktrapi1/connection

Connection Test API

ROOT: /rest/ktrapi1

connection

connection

tests connection with the server
{ "ktrapi1": 
	{ "request_status":
		{ "status": "200" }
	},
	"msg": "Keystone Truck App REST Server."
}

API v1

ROOT: /rest/ktrapi1


Driver App Functions

truckticketinfo

truckticketinfo/{UnitID}

returns current ticket info for truck based on Truck Unit ID
(updated for Keystone 3.1.9 to include ordersno, ordertno)
(updated for Keystone 3.2.8 to include printweights, TicketKey)
(updated for Keystone 3.6.11.1 to include batwtcontacts, ordcmpcontacts)
(updated for Keystone 3.6.99.58 to include OrderKey)
{
  "ticketinfo": [
    {
      "custid": "ALLEN",
      "ticketno": 50001,
      "currentplant": "01",
      "orderid": "510000",
      "jobid": "BELMONT RESERVOIR",
      "joblot": "LOT 1",
      "jobblock": "BLOCK 2A",
      "gpslat": 40.10127,
      "gpslong": -82.94751,
      "gpsradius": 0.2,
      "slump": 3,
      "shipto1": "BELMONT RESERVOIR PUMP STATION",
      "shipto2": "",
      "shipto3": "",
      "shipto4": "",
      "delvinst1": "KNOCK ON BACK DOOR",
      "delvinst2": "",
      "delvinst3": "",
      "delvinst4": "",
      "custname": "Allen Construction",
      "usage": "WALL",
      "ordersno":6992,
      "ordertno":1,
      "deliverydt": "2016-03-17T10:00:00.000Z",
      "printweights": "Y",
      "customerpo": "12369",
      "driver": "TOM",
      "drivername": "Tom Jones",
      "priced": "Y",
      "subtotal": 120,
      "taxtotal": 5,
      "tickettotal": 125,
      "grandtotal": 250,
      "batchstart": "2016-03-17T10:00:00.000Z",
      "batchend": "2016-03-17T10:00:00.000Z",
      "leaveplant": "2016-03-17T10:00:00.000Z",
      "arrivejob": "2016-03-17T10:00:00.000Z",
      "beginpour": "2016-03-17T10:00:00.000Z",
      "endpour": "2016-03-17T10:00:00.000Z",
      "leavejob": "2016-03-17T10:00:00.000Z",
      "returnplant": "2016-03-17T10:00:00.000Z",
      "ordersno": 12672,
      "ordertno": 1,
      "truckstatus": 2,
      "formtype": "119",
      "TicketKey": "3853",
      "OrderKey": "12672K1"
    }
  ],
  "ticketproducts": [
    {
      "lno": 1,
      "productid": "2510-01",
      "description": "2500 PSI w\/ 57 Stone",
      "qtytck": 5,
      "qtydel", 10,
      "qtyord": 60,
      "ums": "CY",
      "unitprice": 78,
      "unitpctdisc": "2%",
      "amount": 390
    },
    {
      "lno": 2,
      "productid": "FIBER-01",
      "description": "FiberMesh",
      "qtytck": 5,
      "qtydel", 10,
      "qtyord": 60,
      "ums": "LB",
      "unitprice": 2.5,
      "unitpctdisc": "2%",
      "amount": 12.5 
    }
  ],
  "contacts": [
    {
      "name": "Ron Livingston",
      "email": "ronl@officespace.com",
      "phone": "444-555-1212"
    }
  ],
  "batwtcontacts": [
    {
      "name": "Ron Livingston",
      "email": "ronl@officespace.com",
      "phone": "444-555-1212"
    }
  ],
  "ordcmpcontacts": [
    {
      "name": "Ron Livingston",
      "email": "ronl@officespace.com",
      "phone": "444-555-1212"
    }
  ]
}

trucksonorder

trucksonorder/{OrderSNO}/{OrderTNO}

returns all trucks currently active on specified order (new for Keystone 3.1.9)
{
  "trucksonorder": [
    {
      "ldno": 1,
      "truckid": "100",
      "status": 4,
      "statusdt": "2017-04-21T08:11:55.000Z",
      "void": "N"
    },
    {
      "ldno": 2,
      "truckid": "101",
      "status": 3,
      "statusdt": "2017-04-21T08:11:57.000Z",
      "void": "Y"
    },
    {
      "ldno": 3,
      "truckid": "102",
      "status": 1,
      "statusdt": "2017-04-21T08:11:00.000Z",
      "void": "N"
    }
  ]
}

ticket [PUT]

ticket/{id}

send updated ticket information and images to Keystone (new for Keystone 3.2.8)
PostData:
{ "Ticket": 
  {
    "CustomerNotes": "Here are some customer notes",
    "DriverNotes": "And now some driver notes",
    "EmailedTo": "And some email addresses",
    "PrintWeights": "Y",
    "PlantId": "01",
    "OrderId": "2732",
    "TicketNo": 99751,
    "TicketDt": "2018-02-26T13:12:00z000",
    "Documents": [
      { "DocType": "Ticket",
        "FileName": "ticket99751.pdf",
        "Data": "..." // base-64 encoded file data
      },
      { "DocType": "BatchWeight",
        "FileName": "bw99751.png",
        "Data": "..." // base-64 encoded file data
      }
    ]
  }
}