IBC. Inc.

IBC Shipping Label REST Service

Introduction

This REST service allows your system to create a Fedex Express, SmartPost , Ground labels or UPS Ground Labels using standalone, web or script based program.

Your client must use POST, DELETE and PUT HTTP methods to successfully submit your label create, label delete and manifest close requests.

The service URL is:
 https://api.pactrak.com/ibclabel/service 

Attention: This is a secure service, you need to obtain a security token first and append your token entry as a parameter to the URL above.
This is a sample URL with an authority token:
https://api.pactrak.com/ibclabel/service/...../?token=NmIzY2Y1OWV8SmFoMnclWl5Od1p2S1NzVw==

Please visit the Authority Web service for information on how to receive an authority token.
https://api.pactrak.com/authority/documentation.html

Default values

Your service requests will use some or all of the following values:

Label Create Requests

To create a new label you will need:

  • Submit a HTTP POST request to the server.
  • The URL should have the following format:

     https://api.pactrak.com/ibclabel/service/STATION_CODE/SERVICE_CODE/ManifestID 

  • The request data feed JSON format.
  • /** Main Submission object called feed */
    feed = {
    /** The first object to define is the customer/recipient information. */
    "customer": {
    "name": "", /* required */
    "company": "",
    "phone": "", /* required */
    "address1": "", /* required */
    "address2": "",
    "city": "", /* required */
    "state": "", /* required */
    "postalCode": "", /* required */
    "countryCode": "" /* required - should be 'US' */
    },
    "item": { /** For Fedex multilot Shipments use: 'items' and pass an array of these types of objects. */
    "weight": "", /* required */
    "weight_unit": "", /* required (LB, KG)*/
    "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)*/
    "insuranceAmount": "",
    "futureDayShipmentDays": "" /* You can advance the ship date with this value, min 1 max 10 */
    }
    }

Label Delete Requests

To delete a label you will need:

  • Submit a HTTP DELETE request to the server.
  • The URL should have the following format:

     https://api.pactrak.com/ibclabel/service/STATION_CODE/SERVICE_CODE/ServiceTrackNumber 

Manifest Closing

To close your labels on the ship date: (NOT NEEDED For UPSG service)

  • Submit a HTTP PUT request to the server.
  • This procedure is only needed for Fedex Ground and SmartPost.
  • The URL should have the following format:

     https://api.pactrak.com/ibclabel/service/STATION_CODE/SERVICE_CODE/ManifestID 

How to submit your data

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 ). To create a label under Manifest 1G161122 you will execute:

curl -siL -X POST --data "@input-file.txt" https://api.pactrak.com/ibclabel/service/TST/G/1G161121?token=...

This is a sample JSON structure ready for testing.

feed={ "customer":{ "name":"Mike Bello", "company":"IBC Inc.", "phone":"305 591 8080", "address1":"8401 NW 17th St", "city":"Miami", "state":"FL", "postalCode":"33126", "countryCode":"US" }, "item":{ "weight":"1", "weight_unit":"LB", "packaging":"BOX", "description":"magazines" } }

The following code is a sample input request for a Fedex Multilot shipment.

feed={ "customer":{ "name":"Mike Bello", "company":"IBC Inc.", "phone":"305 591 8080", "address1":"8401 NW 17th St", "city":"Miami", "state":"FL", "postalCode":"33126", "countryCode":"US" }, "items":[{ "weight":"1", "weight_unit":"LB", "packaging":"BOX", "description":"magazines" }, { "weight":"2", "weight_unit":"LB", "packaging":"BOX", "description":"magazines" }] }

Here is a sample curl delete request for Smartpost Fedex track number 76564231111: *To delete 2D shipments use code 'E'.

curl -siL -X DELETE https://api.pactrak.com/ibclabel/service/TST/S/76564231111?token=...

Here is a sample curl request to close ground manifest 1S161122:

curl -siL -X PUT https://api.pactrak.com/ibclabel/service/TST/G/1S161122?token=...

After making a successful submission you should expect a return of one of the following JSON structures:

Response JSON structure

{
/**
* 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/service/",

/**
* 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. On multi-lot requests this will be an Array Object.*/
"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": "ZPLII", /** Defaults to ZPLII */
"trackNumbers": [ "" ], /** This is an array object. The first item in the array is your Fedex track number. */
"service": "", /** FXSP or FDXG */
"notes": "",
"notices": "",
"provider": "",
"jobId": "", /** A unique Job Id created by the service provider. */
"barcode": "", /** The data that created the barcode printed on the label.. */
"barcode_type": "", /** USPS for SmartPost or FEDEX_1D for Gound */
"report": ""
},

/**
* The direct responses from the label provider with the details of your label transactions, when requesting multi-lot shipments. Note: may not appear on error responses. * @type JSON Array.
*/
"service_answers": [ {"service_answer"}....
]
}

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.

Developer Resources

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.

Useful Links