This REST service allows your system to create shipping labels using standalone, web or script based program.
Your client should use POST, DELETE, PUT HTTP methods to successfully submit your label create and label delete requests.
The service URL is:
https://api.pactrak.com/ibclabel/vitrual
Your service requests URLs will need to use these variable parameters:
Your service request URL can contain these optional parameters:
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 - for PBW should be 'US' */
},
/** This object describes the shipper information */
"shipper":{
"ibc_reference": "####", /* Use the shipper account number IBC assigned */
"name":"", /* required */
"company":"",
"phone":"", /* required */
"address1":"", /* required */
"address2": "",
"city":"", /* required */
"state":"", /* required */
"postalCode":"", /* required */
"countryCode":"" /* required */
},
/* This object describes the physial item being shipped */
"item": {
"weight": "", /* required */
"weight_unit": "", /* required (OZ, GM, LB) ounces, grams or pounds */
"value": "", /* required */
"packaging": "", /* required ( BAG, BOX, ENVELOPE, OTHER )*/
"description": "", /* required */
"length": "", /* required if supplying dimensions */
"width": "", /* required if supplying dimensions */
"height": "", /* required if supplying dimensions */
"dim_unit": "" /* required if supplying dimensions (IN, CM)*/
},
"request_id": "", /* optional */
"reference": "", /* optional - any reference id for your transaction */
"profile_key": ##, /* required (numeric) when _gw is supplied, IBC will provide you with this value */
"route": "" /* required when _gw is supplied, IBC will provide you with this value */
}
Use these codes for Fedex Labels
- S: SmartPost - requires close manifest
- R: SmartPostReturn
- G: Ground - requires close manifest
- GH: Ground Home Delivery - requires close manifest
- 2D: Fedex 2Day service
- E: Fedex Express label
- P: Fedex Priority label
See shipment label options for optional label configurations, default is ZPLII 4x6 Stock label
Use these codes for UPS Labels
- UPSG: UPS Ground Service
- UPSN: UPS NextDay Service
- For residential delivery add ?residential as a parameter to your request URL.
The service supports returning ZPL, GIF, SPL, EPL or PNG image of the label. Use the stock_type parameter in your URL request to change the type. If you don't use the parameter the ZPL code is returned.
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_SIZElabel_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
label_type | label_size |
---|---|
ZPL | 4X6 |
EPL | |
GIF | |
SPL | |
PNG |
Use only KG, LB as weight_unit
To delete a label you will need:
https://api.pactrak.com/ibclabel/virtual/STATION_CODE/SERVICE_CODE/ServiceTrackNumber
See service code list, for UPS services just use UPS as the service code
To close your labels on the ship date:
https://api.pactrak.com/ibclabel/virtual/STATION_CODE/SERVICE_CODE/MANIFEST_ID
We recommend you setup your day with a manifest id of your choice, produce your labels under that id and then send 1 close request per day for that manifest.
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 station code TST for TEST entries.
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":"https://api.pactrak.com/ibclabel/virtual/",
/**
* 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": "", /** true when label data feed is available in the label_feed object */
"label_type": "ZPL2", /** Defaults to ZPL2 */
"trackNumbers": [ "" ], /** This is an array object. The first item in the array is your main track number.
PBW services returns also a secondary track number for references. */
"service": "", /** Service requested */
"notes": "",
"notices": "",
"provider": "",
"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 */
}
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