Manipulate shipping labels

Learn how to use the Merchant Fulfillment API to manipulate shipping labels.

Learn how to use the Merchant Fulfillment API to manipulate shipping labels. The createShipment and getShipment operations return a shipping label file in PDF, PNG, or ZPL format, depending on the carrier. Amazon compresses the document data before it returns it as a Base64-encoded string.

Prerequisites

To complete this tutorial, you need:

Extract document data from a compressed file

  1. Decode the Base64-encoded string.
  2. Save the decoded string with a .gzip extension.
  3. Extract the PDF, PNG, or ZPL file from the GZIP file.

createShipment and getShipment also return a Base64-encoded MD5 hash to validate the document data.

Reprint a shipping label

  1. Call the getShipment operation and include the ShipmentId for the shipment that requires the shipping label.
  2. Extract and print the shipping label from the FileContents element that is returned by the getShipment operation.