Write One Request for PB Expedited and PB Standard¶
Overview¶
You can write one Create Shipment request and use it for both PB Expedited Delivery and PB Standard Delivery. When issuing the request, change the values according to the label needed.
Example Payload¶
The following example shows the top-level fields you must include in the request body to allow it to print either an Expedited Delivery or Standard Delivery label.
The references
array and the two shipment options ending in FACILITY_ID
are used only for PB Standard labels, but they can remain in the request for PB Expedited. The API will ignore them for PB Expedited.
{
"fromAddress": { <value> },
"toAddress": { <value> },
"parcel": {
"weight": { <value> },
"dimension": { <value> }
},
"rates": [ {
"carrier": "<value>",
"serviceId": "<value>",
"parcelType": "<value>",
"specialServices": [ { <value> }, ... ]
} ],
"documents": [ { <value> } ],
"shipmentOptions": [ {
"name": "SHIPPER_ID",
"value": "<value>"
},{
"name": "ADD_TO_MANIFEST",
"value": "<value>"
},{
"name": "CLIENT_FACILITY_ID",
"value": "<value>"
},{
"name": "CARRIER_FACILITY_ID",
"value": "<value>"
},{
"name": "PRINT_CUSTOM_MESSAGE_2",
"value": "<value>"
}
],
"references": [ {
"name": "ReferenceNumber",
"value": "<value>"
},{
"name": "AddlRef1",
"value": "<value>"
},{
"name": "AddlRef2",
"value": "<value>"
} ]
}
Entering Field Values¶
Set values as follows, depending on the label:
Field |
PB Expedited Values |
PB Standard Values |
---|---|---|
|
|
|
|
Enter desired Expedited options from the PB reference page. |
Enter desired Standard options from the PB reference page. |
|
Include the If Enter Expedited options from Shipment Options as desired. |
Include the Include the Enter other Standard options from Shipment Options as desired. |
|
The API ignores the |
Enter reference values as desired. See PB Delivery References. |
Comparison of an Expedited and Standard Request¶
The following is a comparison of a request issued for PB Expedited with a request issued for PB Standard:
Line 17 sets the carrier. This is set to
USPS
for Expedited andPBCS
for Standard.Line 18 sets the service.
Line 20 sets the special services. In this example, the Expedited request sets two special services (
DelCon
&Ins
) and the Standard request sets one (DelCon
).Lines 44 & 47 sets the PB Standard facility IDs. PB Expedited does not use these IDs but they remain in the Expedited request because the API ignores them.
Line 54 sets references for PB Standard. PB Expedited does not use this array but it remains in the Expedited request because the API ignores it.
1{
2 "fromAddress": { ... },
3 "toAddress": { ... },
4 "parcel": {
5 "weight": {
6 "unitOfMeasurement": "OZ",
7 "weight": 8
8 },
9 "dimension": {
10 "unitOfMeasurement": "IN",
11 "length": 6,
12 "width": 1,
13 "height": 4
14 }
15 },
16 "rates": [ {
17 "carrier": "USPS",
18 "serviceId": "PM",
19 "parcelType": "PKG",
20 "specialServices": [ {
21 "specialServiceId": "DelCon",
22 "inputParameters": [ ]
23 },{
24 "specialServiceId": "Ins",
25 "inputParameters": [ {
26 "name": "INPUT_VALUE",
27 "value": "50"
28 } ]
29 } ]
30 } ],
31 "documents": [ {
32 "size": "DOC_4X6",
33 "fileFormat": "PDF",
34 "contentType": "URL",
35 "type": "SHIPPING_LABEL"
36 } ],
37 "shipmentOptions": [ {
38 "name": "SHIPPER_ID",
39 "value": "9024324564"
40 },{
41 "name": "ADD_TO_MANIFEST",
42 "value": "true"
43 },{
44 "name": "CLIENT_FACILITY_ID",
45 "value": "0093"
46 },{
47 "name": "CARRIER_FACILITY_ID",
48 "value": "1585"
49 },{
50 "name": "PRINT_CUSTOM_MESSAGE_2",
51 "value": "Thank you for shopping with us!"
52 }
53 ],
54 "references": [ {
55 "name": "ReferenceNumber",
56 "value": "00029147"
57 },{
58 "name": "AddlRef1",
59 "value": "124C78d576-5432"
60 },{
61 "name": "AddlRef2",
62 "value": "CC4321"
63 } ]
64}
|
1 {
2 "fromAddress": { ... },
3 "toAddress": { ... },
4 "parcel": {
5 "weight": {
6 "unitOfMeasurement": "OZ",
7 "weight": 8
8 },
9 "dimension": {
10 "unitOfMeasurement": "IN",
11 "length": 6,
12 "width": 1,
13 "height": 4
14 }
15 },
16 "rates": [ {
17 "carrier": "PBCS",
18 "serviceId": "PRCLSEL",
19 "parcelType": "PKG",
20 "specialServices": [ {
21 "specialServiceId": "DelCon",
22 "inputParameters": [ ]
23
24
25
26
27
28
29 } ]
30 } ],
31 "documents": [ {
32 "size": "DOC_4X6",
33 "fileFormat": "PDF",
34 "contentType": "URL",
35 "type": "SHIPPING_LABEL"
36 } ],
37 "shipmentOptions": [ {
38 "name": "SHIPPER_ID",
39 "value": "9024324564"
40 },{
41 "name": "ADD_TO_MANIFEST",
42 "value": "true"
43 },{
44 "name": "CLIENT_FACILITY_ID",
45 "value": "0093"
46 },{
47 "name": "CARRIER_FACILITY_ID",
48 "value": "1585"
49 },{
50 "name": "PRINT_CUSTOM_MESSAGE_2",
51 "value": "Thank you for shopping with us!"
52 }
53 ],
54 "references": [ {
55 "name": "ReferenceNumber",
56 "value": "00029147"
57 },{
58 "name": "AddlRef1",
59 "value": "124C78d576-5432"
60 },{
61 "name": "AddlRef2",
62 "value": "CC4321"
63 } ]
64 }
|