Example Request Written for both Expedited and Standard

← Carriers FAQs

Example Request Body

The following is an example Create Delivery Shipment request body you can use to print both PB Expedited and PB Standard delivery labels. The example shows the top-level fields you must include in the request to allow it to print both label types. Note that the references array and the two *_FACILITY_ID shipment options 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

rates.carrier

USPS

PBCS

rates.serviceId,
rates.parcelType,
rates.specialServices

Enter desired Expedited options from the PB reference page.

Enter desired Standard options from the PB reference page.

shipmentOptions

Include the SHIPPER_ID option.

If CLIENT_FACILITY_ID and CARRIER_FACILITY_ID are present from a previous PB Standard call, you can leave them in. The API will ignore them.

Enter Expedited options from Shipment Options as desired.

Include the SHIPPER_ID option.

Include the CLIENT_FACILITY_ID and CARRIER_FACILITY_ID options and set them to the values assigned to the merchant during Onboarding with PB Standard.

Enter other Standard options from Shipment Options as desired.

references

The API ignores the references array. If the array is present from a previous PB Standard call, you can leave it in.

Enter reference values as desired. See References Array in a PB Standard Shipment.

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 and PBCS for Standard.

  • Line 18 sets the mail class.

  • 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.

Expedited Delivery Shipment:
 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}
Standard Delivery Shipment:
 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 }