
This REST service allows your system to create shipping labels using standalone, web or script based program.
Your client should use POST HTTP method to successfully submit your label create requests.
The service URL is:
https://api.pactrak.com/shiplabel/v1/
Your service requests URLs will need to use these variable parameters:
Your service request URL can contain these optional parameters:
For example - for a Fedex Ground test label for MIA station:
https://api.pactrak.com/shiplabel/v1/MIA/G?_test
To create a new label you will need:
{ /** This object describes the recipient information. */
"customer": {
"name": "", /* required */
"company": "",
"phone": "", /* required */
"address1": "", /* required */
"address2": "",
"city": "", /* required */
"state": "", /* required */
"postalCode": "", /* required */
"countryCode": "" /* required - should always be 'US' */
},
/** This object describes the shipper information */
"shipper":{
"ibc_account": "####", /* Use the shipper account number IBC assigned -required */
"name":"", /* required */
"company":"",
"phone":"", /* required */
"address1":"", /* required */
"address2": "",
"city":"", /* required */
"state":"", /* required */
"postalCode":"", /* required */
"countryCode":"" /* required - ISO two letter code */
},
/* This object describes the physial item being shipped */
"items": [
{
"weight": 0.00, /* required */
"weight_unit": "", /* required (OZ, GM, LB) ounces, grams or pounds */
"value": 0.00, /* required */
"packaging": "", /* required ( BAG, BOX, ENVELOPE, OTHER )*/
"description": "", /* required */
"length": 0, /* required if supplying dimensions */
"width": 0, /* required if supplying dimensions */
"height": 0, /* required if supplying dimensions */
"dim_unit": "" /* required if supplying dimensions (IN, CM)*/
}
],
"reference": "", /* optional - any reference id for your transaction */
}
Use these codes for Fedex Labels
- S: SmartPost - requires close manifest
- G: Ground - requires close manifest
- GH: Ground Home Delivery - requires close manifest
- E: Fedex Express label
See shipment label options for optional label configurations, default is ZPLII 4x6 Stock label
The requests allow you to modify the return typle. You can modify the label type by appending the following parameters to your URL:
?label_type=LABEL_TYPE&label_size=LABEL_SIZE| label_type | label_size |
|---|---|
| ZPLII | STOCK_4X6 |
| EPL2 | STOCK_4X6.75_LEADING_DOC_TAB |
| DPL | STOCK_4X6.75_TRAILING_DOC_TAB |
| STOCK_4X8 | |
| STOCK_4X9_LEADING_DOC_TAB | |
| STOCK_4X9_TRAILING_DOC_TAB |
| label_type | label_size |
|---|---|
| PAPER_4X6 | |
| PNG | PAPER_4X8 |
| RTF | PAPER_4X9 |
| TEXT | PAPER_7X4.75 |
| PAPER_8.5X11_TOP_HALF_LABEL | |
| PAPER_8.5X11_BOTTOM_HALF_LABEL | |
| PAPER_LETTER |
Use only KG, LB as weight_unit
To delete a label you will need:
https://api.pactrak.com/shiplabel/v1/STATION_CODE/SERVICE_CODE/TRACK_NUMBER
For all Fedex services, you can just use 'F' as the service code.
You will need to obtain a security token before submitting your test or production requests.
The easiest way to test your POST request is to use cURL from the system's command line. Use the url parameter code _test for TEST entries.
For example - for a Fedex Ground test label for MIA station:
https://api.pactrak.com/shiplabel/v1/MIA/G?_test
We recommend saving your JSON structure into a text file ( input-file.txt ).
After making a successful submission you should expect a return of one of the following JSON structures:
{ /**
* The HTTP response code
* @type Integer.
*/
"code": , /** Successful response: 200, Error response: 40x */
/**
* Response message relevant to the action requested.
* @type String.
*/
"message":"",
/**
* Detailed Response message relevant to the action requested.
* @type String.
*/
"developerMessage":"",
/**
* A link to the resource.
* @type String.
*/
"href":"/shiplabel/v1/..",
/**
* The direct response from the label provider with the details of your label transaction. Note:
may not appear on error responses.
* @type JSON Object.
*/
"service_answer": [
{
/** Note: not all items will be available on all responses. Most are for informational purposes only. */
"message": "", /** */
"label_feed": "", /** The data feed that is used to create your physical label. The data is base64 encoded.*/
"labelResponse": "", /** informational details about the label feed */
"label_type": "LABEL-ZPLII", /** Defaults to LABEL-ZPLII*/
"trackNumbers": [ "" ], /** This is an array object. The first item in the array is your main track number. */
"service": "", /** Service requested */
"notes": "",
"notices": "",
"jobId": "", /** A unique Job Id created by the service provider. */
"barcode": "", /** The data that created the barcode printed on the label.. */
}
],
"trackNumber": "" /** This is the internal number IBC will use for your shipment */
"is_error": false, /** true or false */
"completion_time": "" /** informational purposes */
}
On error responses the Developer message object will contain a validity report with details of the issues found with the input provided. It is formatted with end of line chars "\n" so that it will be readable in your browser's web console.
Restful services are capable of receiving requests form web based or standalone applications. We have tested our services to comply with REST standards, returning appropriate HTTP codes to help developers using commonly used frameworks as JQuery or Prototype.
Additionally, there are many examples from many different programming languages such as C#, Java, PHP and C++.
If you desire to test or need Java sample code, the following project is an example of how to call an HTTP Rest service using HTTP Post protocol, IBCPost.
ZPL printing
- Zebra Windows help
- Linux printing
Base64
- Encode / Decode and samples