USPS-REST - Label

Carrier: USPS-REST
Action: Label
Description: Example implementation for USPS-REST Label
{
  "carrier": "USPS-REST",
  "action": "SubmitShipment",
  "params": {
    "key": "your-key-from-authenticate-request",
    "payment_token": "key-from-PurchasePostage-response",
    "packages": [
      {
        "weight": 4.3,
        "length": 7,
        "width": 7,
        "height": 8,
        "reference_value": "reference1",
        "reference_value2": "reference2"
      }
    ],
    "service": "PARCEL_SELECT",
    "shipper": "RocketShipIt",
    "ship_contact": "John Doe",
    "ship_addr1": "123 Main St",
    "ship_city": "Whitehall",
    "ship_state": "MT",
    "ship_code": "59759",
    "ship_phone": "1231231234",
    "ship_country": "US",
    "to_name": "John Doe",
    "to_addr1": "940 Presidio Ave",
    "to_addr2": "#103",
    "to_state": "CA",
    "to_city": "San Francisco",
    "to_code": "94115",
    "to_country": "US",
    "image_type": "PDF",
    "test": true
  }
}

<?php
$rs = new RocketShipIt;
$response = $rs->request(
array (
  'carrier' => 'USPS-REST',
  'action' => 'SubmitShipment',
  'params' => 
  array (
    'key' => 'your-key-from-authenticate-request',
    'payment_token' => 'key-from-PurchasePostage-response',
    'packages' => 
    array (
      0 => 
      array (
        'weight' => 4.3,
        'length' => 7,
        'width' => 7,
        'height' => 8,
        'reference_value' => 'reference1',
        'reference_value2' => 'reference2',
      ),
    ),
    'service' => 'PARCEL_SELECT',
    'shipper' => 'RocketShipIt',
    'ship_contact' => 'John Doe',
    'ship_addr1' => '123 Main St',
    'ship_city' => 'Whitehall',
    'ship_state' => 'MT',
    'ship_code' => '59759',
    'ship_phone' => '1231231234',
    'ship_country' => 'US',
    'to_name' => 'John Doe',
    'to_addr1' => '940 Presidio Ave',
    'to_addr2' => '#103',
    'to_state' => 'CA',
    'to_city' => 'San Francisco',
    'to_code' => '94115',
    'to_country' => 'US',
    'image_type' => 'PDF',
    'test' => true,
  ),
)
);

rs.request(
  {'action': 'SubmitShipment',
 'carrier': 'USPS-REST',
 'params': {'image_type': 'PDF',
            'key': 'your-key-from-authenticate-request',
            'packages': [{'height': 8,
                          'length': 7,
                          'reference_value': 'reference1',
                          'reference_value2': 'reference2',
                          'weight': 4.3,
                          'width': 7}],
            'payment_token': 'key-from-PurchasePostage-response',
            'service': 'PARCEL_SELECT',
            'ship_addr1': '123 Main St',
            'ship_city': 'Whitehall',
            'ship_code': '59759',
            'ship_contact': 'John Doe',
            'ship_country': 'US',
            'ship_phone': '1231231234',
            'ship_state': 'MT',
            'shipper': 'RocketShipIt',
            'test': True,
            'to_addr1': '940 Presidio Ave',
            'to_addr2': '#103',
            'to_city': 'San Francisco',
            'to_code': '94115',
            'to_country': 'US',
            'to_name': 'John Doe',
            'to_state': 'CA'}}

)

rs.request(
  {"carrier"=>"USPS-REST",
 "action"=>"SubmitShipment",
 "params"=>
  {"key"=>"your-key-from-authenticate-request",
   "payment_token"=>"key-from-PurchasePostage-response",
   "packages"=>
    [{"weight"=>4.3,
      "length"=>7,
      "width"=>7,
      "height"=>8,
      "reference_value"=>"reference1",
      "reference_value2"=>"reference2"}],
   "service"=>"PARCEL_SELECT",
   "shipper"=>"RocketShipIt",
   "ship_contact"=>"John Doe",
   "ship_addr1"=>"123 Main St",
   "ship_city"=>"Whitehall",
   "ship_state"=>"MT",
   "ship_code"=>"59759",
   "ship_phone"=>"1231231234",
   "ship_country"=>"US",
   "to_name"=>"John Doe",
   "to_addr1"=>"940 Presidio Ave",
   "to_addr2"=>"#103",
   "to_state"=>"CA",
   "to_city"=>"San Francisco",
   "to_code"=>"94115",
   "to_country"=>"US",
   "image_type"=>"PDF",
   "test"=>true}}

)

rocketshipit.request(
  {
  "carrier": "USPS-REST",
  "action": "SubmitShipment",
  "params": {
    "key": "your-key-from-authenticate-request",
    "payment_token": "key-from-PurchasePostage-response",
    "packages": [
      {
        "weight": 4.3,
        "length": 7,
        "width": 7,
        "height": 8,
        "reference_value": "reference1",
        "reference_value2": "reference2"
      }
    ],
    "service": "PARCEL_SELECT",
    "shipper": "RocketShipIt",
    "ship_contact": "John Doe",
    "ship_addr1": "123 Main St",
    "ship_city": "Whitehall",
    "ship_state": "MT",
    "ship_code": "59759",
    "ship_phone": "1231231234",
    "ship_country": "US",
    "to_name": "John Doe",
    "to_addr1": "940 Presidio Ave",
    "to_addr2": "#103",
    "to_state": "CA",
    "to_city": "San Francisco",
    "to_code": "94115",
    "to_country": "US",
    "image_type": "PDF",
    "test": true
  }
}
)
← Back to All Examples

Other USPS-REST Examples

Address Validation
Example implementation for USPS-REST Address Validation
Address Validation City/State from Zip
Example implementation for USPS-REST Address Validation City/State from Zip
Authenticate
Example implementation for USPS-REST Authenticate
Authenticate using apis endpoint
Example implementation for USPS-REST Authenticate using apis endpoint
Create Manifest
Example implementation for USPS-REST Create Manifest
Get Purchase Token
Example implementation for USPS-REST Get Purchase Token
Label Return
Example implementation for USPS-REST Label Return
Rate Single with rate indicator
Example implementation for USPS-REST Rate Single with rate indicator
Rates
Example implementation for USPS-REST Rates
Tracking
Example implementation for USPS-REST Tracking
Void Shipment
Example implementation for USPS-REST Void Shipment