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:
- Authorization from the selling partner for whom you are making calls. For more information, refer to Authorizing Selling Partner API applications.
- The Direct-to-Consumer Shipping (Restricted) role assigned to your developer profile.
- The Direct-to-Consumer Shipping (Restricted) role selected in the app registration page for your application.
Extract document data from a compressed file
Note
These are restricted operations and require a Restricted Data Token (RDT) for authorization. Some operations require restrictions because they contain customer PII data. These operations require passing an additional security review. For more information on RDT, refer to the Tokens API guide.
- Decode the Base64-encoded string.
- Save the decoded string with a
.gzipextension. - 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
Note
This is a restricted operation and requires a Restricted Data Token (RDT) for authorization. Some operations require restrictions because they contain customer PII data. These operations require passing an additional security review. For more information on RDT, refer to the Tokens API guide.
- Call the
getShipmentoperation and include theShipmentIdfor the shipment that requires the shipping label. - Extract and print the shipping label from the
FileContentselement that is returned by thegetShipmentoperation.
Updated 14 days ago
