Keystone Customer Portal REST API: Difference between revisions

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

Latest revision as of 12:58, 14 July 2023

Overview

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

See: Keystone_REST_Server_(KServer) for more on KServer.

Example URIs:

http://127.0.0.1:8213/rest/kcpapi1/connection

Negotiation API

ROOT: /rest/kcpapi

apinegotiate

apinegotiate/{ClientId}/{ClientApiMin}/{ClientApi}

negotiates API version with the server and returns
1

API v1

ROOT: /rest/kcpapi1

System/Session Functions

userlookup

userlookup/{UserId}/

looks up UserId and returns a list of customer keys
{ "userkeys": 
  [
    { "key": "aZ8y123ug1Mp9aZ8y123ug1Mp9",
      "coname": "XYZ Concrete",
      "custname": "Allen Construction"
    },
    { "key": "Z8y123ug1Mp9aZ8y123ug1Mp9a",
      "coname": "Alberts Redi-Mix",
      "custname": "Allen Construction"
    }
  ]
}

userlogin

userlogin/{UserId}/{UserKey}/{OSVersion}

logs in specified UserId and UserKey and returns session information
{ "session": 
  { "key": "abcdefg",
    "fullname": "John Q Public",
    "groupname": "user",
    "securityclass": "50",
    "entityid": "ALL100",
    "roleclass": "C",
    "options": ""
  }
}

userlogout

userlogout/{SessionKey}

logs out user and closes out session for specified SessionKey

usersessionexpired

usersessionexpired/{UserId}/{UserKey}

logs out specified UserId and UserKey


Portal Functions

getcurrentorders

getcurrentorders

returns current and future orders for all customers

getcurrentorders/{CustId}

returns current and future orders for specified CustId
{
  "currentorders": [
    {
      "sno": 510002,
      "tno": 1,
      "custid": "BER100",
      "orderid": "510000",
      "productid": "2510-01",
      "description": "2500 PSI w\/ 57 Stone",
      "qtyord": 60,
      "slump": 3,
      "custname": "Berkshire Power",
      "jobid": "BELMONT RESERVOIR",
      "shipto1": "BELMONT RESERVOIR PUMP STATION",
      "usage": "SIDEWALK",
      "ldcnt": 2,
      "ldcompcnt": 8,
      "completed": "N",
      "deliverydt": "2016-03-17T10:00:00.000Z",
      "nextlddt": "2016-03-17T14:36:28.000Z"
    },
    {
      "sno": 510002,
      "tno": 4,
      "custid": "ALLEN",
      "orderid": "510001",
      "productid": "3010-01",
      "description": "3000 PSI w\/ 1\" Stone",
      "qtyord": 50,
      "slump": 3,
      "custname": "Allen Construction",
      "jobid": "PARK-N-RIDE",
      "shipto1": "2400 Corporate Exchange Dr",
      "usage": "CURBS",
      "ldcnt": 3,
      "ldcompcnt": 7,
      "completed": "N",
      "deliverydt": "2016-03-17T10:15:00.000Z",
      "nextlddt": "2016-03-17T14:45:00.000Z"
    }
  ]
}


gethistoricalorders

gethistoricalorders

returns historical orders for all customers for the last 30 days

gethistoricalorders/{CustId}

returns historical orders for specified CustId for the last 30 days

gethistoricalorders/{LoDate}/{HiDate}

returns historical orders for all customers within the specified Delivery Date range

gethistoricalorders/{CustId}/{LoDate}/{HiDate}

returns historical orders for specified CustId within the specified Delivery Date range
{
  "historicalorders": [
    {
      "sno": 6980,
      "tno": 7,
      "custid": "COD",
      "orderid": "2715",
      "slump": 3,
      "jobid": "JACK JOHNSON",
      "shipto1": "Jack Johnson",
      "custpo": "Verbal",
      "custname": "CASH SALES",
      "qtyord": 6,
      "deliverydt": "2013-12-12T14:00:00.000Z"
    },
    {
      "sno": 6980,
      "tno": 4,
      "custid": "ALLEN",
      "orderid": "2714",
      "slump": 3,
      "jobid": "PARK-N-RIDE",
      "shipto1": "2400 Corporate Exchange Dr",
      "custname": "Allen Construction",
      "usage": "BASE",
      "qtyord": 100,
      "deliverydt": "2013-12-12T13:30:00.000Z"
    },
    {
      "sno": 6980,
      "tno": 1,
      "custid": "ALLEN",
      "orderid": "2713",
      "slump": 3,
      "jobid": "ECCO VALLEY",
      "custname": "Allen Construction",
      "qtyord": 20,
      "deliverydt": "2013-12-12T13:00:00.000Z"
    }
  ]
}


getorderdetails

getorderdetails/{SessionNo}/{TransNo}

returns order header, products and loads for specified order SessionNo, TransNo
{
  "orderinfo": [
    {
      "custid": "BER100",
      "orderid": "510000",
      "slump": 3,
      "jobid": "BELMONT RESERVOIR",
      "shipto1": "BELMONT RESERVOIR PUMP STATION",
      "custname": "Berkshire Power",
      "usage": "SIDEWALK",
      "qtyord": 60,
      "qtydel": 30,
      "deliverydt": "2016-03-17T10:00:00.000Z"
    }
  ],
  "orderproducts": [
    {
      "lno": 1,
      "productid": "2510-01",
      "description": "2500 PSI w\/ 57 Stone",
      "qtyord": 60,
      "ldsize": 5,
      "ums": "CY"
    },
    {
      "lno": 2,
      "productid": "FIBER-01",
      "description": "FiberMesh",
      "qtyord": 3,
      "ldsize": 0,
      "ums": "LB"
    }
  ],
  "orderloads": [
    {
      "ldno": 1,
      "plantid": "01",
      "truckid": "101",
      "ldsize": 5,
      "status": 8,
      "ticketno": 510001,
      "ticketdt": "2016-03-17T09:52:00.000Z",
      "onjobdt": "2016-03-17T10:07:23.000Z",
      "beginpourdt": "2016-03-17T10:15:11.000Z",
      "endpourdt": "2016-03-17T10:44:12.000Z"
    },
    {
      "ldno": 2,
      "plantid": "01",
      "truckid": "110",
      "ldsize": 5,
      "status": 8,
      "ticketno": 510008,
      "ticketdt": "2016-03-17T10:18:00.000Z",
      "onjobdt": "2016-03-17T10:25:51.000Z",
      "beginpourdt": "2016-03-17T10:33:50.000Z",
      "endpourdt": "2016-03-17T11:02:41.000Z"
    },
    {
      "ldno": 3,
      "plantid": "01",
      "truckid": "101",
      "ldsize": 5,
      "status": 8,
      "ticketno": 510015,
      "ticketdt": "2016-03-17T10:45:00.000Z",
      "onjobdt": "2016-03-17T10:57:13.000Z",
      "beginpourdt": "2016-03-17T11:04:53.000Z",
      "endpourdt": "2016-03-17T11:33:39.000Z"
    },
    {
      "ldno": 4,
      "plantid": "01",
      "truckid": "110",
      "ldsize": 5,
      "status": 8,
      "ticketno": 510022,
      "ticketdt": "2016-03-17T11:17:00.000Z",
      "onjobdt": "2016-03-17T11:30:12.000Z",
      "beginpourdt": "2016-03-17T11:38:00.000Z",
      "endpourdt": "2016-03-17T12:07:30.000Z"
    },
    {
      "ldno": 5,
      "plantid": "01",
      "truckid": "101",
      "ldsize": 5,
      "status": 8,
      "ticketno": 510029,
      "ticketdt": "2016-03-17T11:49:00.000Z",
      "onjobdt": "2016-03-17T12:00:29.000Z",
      "beginpourdt": "2016-03-17T12:08:52.000Z",
      "endpourdt": "2016-03-17T12:37:44.000Z"
    },
    {
      "ldno": 6,
      "plantid": "01",
      "truckid": "110",
      "ldsize": 5,
      "status": 8,
      "ticketno": 510036,
      "ticketdt": "2016-03-17T12:17:00.000Z",
      "onjobdt": "2016-03-17T12:27:43.000Z",
      "beginpourdt": "2016-03-17T12:35:43.000Z",
      "endpourdt": "2016-03-17T13:06:10.000Z"
    },
    {
      "ldno": 7,
      "plantid": "01",
      "truckid": "101",
      "ldsize": 5,
      "status": 5,
      "ticketno": 510042,
      "ticketdt": "2016-03-17T12:43:00.000Z",
      "onjobdt": "2016-03-17T12:51:52.000Z",
      "beginpourdt": "2016-03-17T12:59:27.000Z",
      "endpourdt": "2016-03-17T13:29:27.000Z"
    },
    {
      "ldno": 8,
      "plantid": "01",
      "truckid": "103",
      "ldsize": 5,
      "status": 3,
      "ticketno": 510048,
      "ticketdt": "2016-03-17T13:17:00.000Z",
      "onjobdt": "2016-03-17T13:26:41.000Z",
      "beginpourdt": "2016-03-17T13:35:41.000Z",
      "endpourdt": "2016-03-17T14:05:41.000Z"
    }
  ]
}


getgpstruckinfo

getgpstruckinfo/{UnitID}

returns truck status and order location info for truck based on Truck Unit ID
{
  "gpstruckinfo": [
    {
      "currentplant": "01",
      "ordercode": "510000",
      "ticketno": 50001,
      "jobid": "BELMONT RESERVOIR",
      "statuscode": 2,
      "gpslat": 40.10127,
      "gpslong": -82.94751,
      "gpsradius": 0.2
    }
  ]
}