Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Richer order-object returned from publishedOrders

...

#
Endpoint / DescriptionExample - RequestExample - Response
1


POST /pl/api/v-1/auth/generate

Fetches an login-token that the application can use to gain access to the API.

Get the username/password from DI.


Code Block
{
    "username": "olof",
    "password": "secret123"
}



Code Block
{
	"token": "olof:5f9...842",
	"userId": 23432,
	"customerSystemId": 233,
	"roles": [...]
}


2

🔐

POST /pl/api/v-1/routePlan

Create an empty route plan (for a given distribution date).

companyId: The ID of the transport company. Ask DI for the correct value(s) to use.

Status
colourGreen
titleNEW
distrNo: A grouping mechanism used to separate different distributions during the day (for the "Customer Plus"-view).

Values:

  • 0: N/A (default, same as omitting the field)
  • 1: Night
  • 2: Morning
  • 3: Before noon
  • 4: Afternoon
  • 5: Evening

Will be used for:

  • group plans within same distribution/date
  • ensure that "use-same-route-as-last-time" for addresses don't overlap with other distributions. An address can be part of route "101" on Monday morning, but part of "203" on Monday evening. This will be remembered as long as distrNo is used. Looks for previous route on same distribution/distrNo.


Code Block
{
    "companyId": 1,
    "date": "2015-12-04T00:00:00.000+0100",
	"distrNo": 0,
    "name": "Utkjoring uke 9"
}



Code Block
{
	"id": 344,
	"date": "2015-12-04T00:00:00.000+0100",
	"distrNo": 0,
	"name": "Utkjoring uke 9",
	...
}


3🔐
POST /pl/api/v-1/routePlan/<rp_id>/customerSystem/<cs_id>

Create an empty file (prepare for a file-upload).

Step 1 in file upload.

rp_id: The returned routePlanId from previous call.
cs_id: Ask DI for the correct value to use (or look at the response from /auth/generate)


Code Block
{
    "name": "my-file-name.csv"
}



Code Block
{
	"id": 6722,
	"name": "my-file-name.csv",
	...
}


4🔐
POST /pl/api/v-1/file/<f_id>

Upload the content of the file you have prepared.

Filetypes supported:

  • .csv
  • .xls
  • .xlsx

Mimetype: multipart/form-data. Name the file-field: "file". See file specification.

Step 2 in file upload.

f_id: The returned fileId from previous call.



Code Block
{
	"status": "ok"
}


5🔐
GET /pl/api/v-1/customerSystem/<cs_id>/publishedOrders/<yyyy-mm-dd>

Fetch the published orders including the routename of each order. Also added which pickupLocation the route has.

routeId and pickupLocationId is our internal IDs and will be generated for each new distribution date. Use them only for sorting/grouping if you want an integer instead of a string for that.

companyId tells you which distribution company is handling the order.

Included for each order is an estimate for WHEN the order will be delivered. It's a time interval like this: HH:MM-HH:MM.

This will return orders across many routePlans, but only from published plans for the given distribution-date.

(info) Assumes that imported customers/deliveries used the ORDER_ID field. This is your reference.

cs_id: Ask DI for the correct value to use (or look at the response from /auth/generate)

===

Status
colourGreen
titleNEW
 If called AFTER the distribution has happend, even more information can be extracted from each order, such as:

  • Time the customer got SMS pre-notice
  • Time the driver confirmed the delivery
  • Details about each orderLine (status per product)
  • Aggregated status for customer (deliveryType) (DOOR or CUSTOMER) - you might instead look at status for each orderLine

List of orders

Code Block
[
	{
		"companyId": 1,
		"orderId": "768787",
		"routeId": 6225,
		"routeName": "Sentrumruten",
		"routeSequence": 12,
		"timeWindow": "20:00-23:00",
		"estimatedTime": "16:43",
		"routeId": 6225,
		"pickupLocationId": 988,
		"pickupLocationName": "Storgata 11A, 1234 OSLO",
		"cancelled": false,
		"driverComingNotifiedTime": "16:14",
		"driverConfirmedTime": "17:04",
		"deliveryType": "CUSTOMER",
		"orderLines": [
			{
				"orderLineId": null,
				"product": "15",
				"delivered": true,
				"status": "CUSTOMER"
			}
    	],
	},
	...
]


6🔐
GET /pl/api/v-1/customerSystem/<cs_id>/distributedOrders/<yyyy-mm-dd>

Fetch the status of the orders after they have been distributed.

cs_id: Ask DI for the correct value to use (or look at the response from /auth/generate)

Status
subtletrue
colourBlue
titlePLANNED
 


TODO
7🔐
POST /pl/api/v-1/customerSystem/<cs_id>/purgeOrders

Purge personal information (GDPR) based on given ORDER_IDs (within a customerSystem).

cs_id: Ask DI for the correct value to use (or look at the response from /auth/generate)

Status
subtletrue
colourBlue
titlePLANNED



Code Block
[
	{"orderId": "12345"},
	{"orderId": "34453"},
	{"orderId": "22834"}
]



Code Block
[ 
	{ "orderId": "12345", "status": "purged"},
	{ "orderId": "34453", "status": "purged"},
	{ "orderId": "22834", "status": "none.found"}
]

"status" can be:

  • "purged" (success)
  • "none.found" (could not find order, might allready be purged?) 

...