PackIT API Documentation
The PackIT RESTful API allows you to record past order details and retrieve the rightsized box for packing an order.
To retrieve your API key, set standard sized boxes, identify bad shipments, or manually edit order information, please log in to the PackIT command console.
Overview
Request headers and status codes
The base URIs for all RESTful calls are:
Test - https://packitdev.tricolopstechnology.ca/
Live - https://packit.tricolopstechnology.ca/
The following header for requests should be set:
"Content-Type":"application/json"
If the request has been successfully processed, a status code of 200 will be returned, otherwise a 400-series status code will be returned.
Generate RESTful API calls - PHP
<?php
$obj = array();
$obj["message"] = "Message to be echoed";
$ch = curl_init("https://packitdev.tricolopstechnology.ca/testConnection");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($obj));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Generate RESTful API calls - C#
using System;
using System.IO;
using System.Net;
using System.Collections;
using System.Web.Script.Serialization;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Hashtable obj = new Hashtable();
obj["message"] = "Message to be echoed";
var encoder = new JavaScriptSerializer();
string paramsJson = encoder.Serialize(obj);
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://packitdev.tricolopstechnology.ca/testConnection");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(paramsJson);
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var responseText = streamReader.ReadToEnd();
Console.WriteLine(responseText);
}
}
}
}
Methods
Test Connection
Test connections to PackIT server can be successfully established
URI
Test - https://packitdev.tricolopstechnology.ca/testConnection
Live - https://packit.tricolopstechnology.ca/testConnection
Input Parameters
message | string, optional A message that will be echoed |
Output Parameters
message |
string "Hello from PackIT" |
echo |
string The same message as the input message |
Example Input
{
"message":"Most of the basic truths of life sound absurd at first hearing."
}
Example Output
{
"message":"Hello from PackIT"
"echo":"Most of the basic truths of life sound absurd at first hearing."
}
Create Order
Creates an order that is confirmed and shipped.
URI
Test - https://packitdev.tricolopstechnology.ca/createOrder
Live - https://packit.tricolopstechnology.ca/createOrder
Input Parameters
username
|
string, mandatory API key username |
password
|
string, mandatory API key password |
order_id
|
string, mandatory A unique identifier for the order, if the order with ref_id already exists, it will be deleted and recreated using information from the current request |
country |
string, optional Order destination country |
region |
string, optional Order destination state / province |
city |
string, optional Order destination city |
postal_code |
string, optional Order destination postal code |
address |
string, optional Order destination address in a single line |
company |
string, optional Order destination company |
shipments |
array of shipments, optional List of shipments associated with the order, see Add Shipments |
packages |
array of packages, optional List of packages associated with the order, see Add Packages |
items |
array of items, optional List of items associated with the order, see Add Item |
Output Parameters
error_message |
string "Success" on a successful order creation, otherwise describes the cause of the error |
Example Inputs
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"order_id":"O348"
}
{
"username":"ACME",
"password":"test1234",
"order_id":"O348"
}
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"order_id":"O348",
"country":"CA",
"region":"Ontario",
"city":"Waterloo",
"address":"151 Charles St W",
"company":"Tricolops Technology Inc",
"postal_code":"N2G 1H6"
}
Example Outputs
{
"message":"Success"
}
{
"message":"Authentication failed"
}
{
"message":"Success"
}
Add Shipments
Add shipment information to an existing order
URI
Test - https://packitdev.tricolopstechnology.ca/addShipments
Live - https://packit.tricolopstechnology.ca/addShipments
Input Parameters
username
|
string, mandatory API key username |
password
|
string, mandatory API key password |
order_id
|
string, mandatory A unique identifier for the order that the shipments are associated with |
shipments
|
array, mandatory Array of shipments |
shipment_id |
string, optional An identifier for the shipment If it is provided and the combination of order_id and shipment_id already exists, information about the shipment is updated If it is not provided or the combination of order_id and shipment_id does not exists, a new shipment will be created |
courier |
string, optional The courier used for the shipment |
shipment_method |
string, optional Method of shipment used |
cost |
number, optional Amount of freight charges |
shipped_on |
date, optional Date of shipment in "YYYY-MM-DD hh:mm:ss" format, if it is not provided, it is set to the current time on the PackIT server |
delivered_on |
date, optional Date of delivery in "YYYY-MM-DD hh:mm:ss" format |
packages |
array of packages, optional List of packages associated with the shipment, see Add Packages |
items |
array of items, optional List of items associated with the shipment, see Add Items |
Output Parameters
error_message |
string "Success" on a successful shipment creation, otherwise describes the cause of the error |
Example Inputs
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"order_id":"O348",
"shipments":[
{
"shipment_id":"O348_1"
},
{
"shipment_id":"O348_2"
}
]
}
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"order_id":"O348",
"shipments":[
{
"shipment_id":"O348_1",
"courier":"AB Cartage",
"shipment_method":"Express 2 Day",
"cost":"15.5",
"delivered_on":"2017-12-01"
}
]
}
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"shipments":[
{
"shipment_id":"O348_1"
}
]
}
Example Outputs
{
"message":"Success"
}
{
"message":"Success"
}
{
"message":"Order ID must be specified"
}
Add Packages
Add shipment information to an existing order
URI
Test - https://packitdev.tricolopstechnology.ca/addPackages
Live - https://packit.tricolopstechnology.ca/addPackages
Input Parameters
username
|
string, mandatory API key username |
password
|
string, mandatory API key password |
order_id
|
string, mandatory A unique identifier for the order that the packages are associated with |
shipment_id |
string, optional A unique identifier for the shipment that the package are associated with If the shipment_id is provided, the combination of order_id and shipment_id must already exists by prior calls to Create Order or Add Shipments. If the shipment_id is not provided, the packages will be associated with all shipments within the order |
packages
|
array, mandatory |
package_id |
string, optional A unique identifier for the package If it is provided and the combination of order_id, shipment_id, and package_id already exists, information about the package is updated. If package_id or shipment_id is not provided or the combination of order_id and shipment_id does not exists, a new package will be created |
length |
number, mandatory The longest dimension of the package in the horizontal plane, in constant user defined unit |
width
|
number, mandatory The shortest dimension of the package in the horizontal plane, in constant user defined unit if length is smaller than width, the values will be switched |
height |
number, mandatory The dimension of the package in the vertical plane, in constant user defined unit |
weight
|
number, mandatory The weight of the package, in constant user defined unit |
packer_id |
number, mandatory A unique identifier for the packer responsible for packing the package |
items |
array of items, optional List of items associated with the package, see Add Items |
Output Parameters
error_message |
string "Success" on a successful order creation, otherwise describes the cause of the error |
Example Inputs
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"order_id":"O348",
"shipment_id":"O348_1",
"packages":[
{
"package_id":"O348_1_1"
},
{
"package_id":"O348_1_2"
}
]
}
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"order_id":"O348",
"shipment_id":"O348_1"
"packages":[
{
"package_id":"O348_1_1",
"length":10,
"width":11,
"height":12,
"weight":10,
"packer_id":5
},
{
"package_id":"O348_1_2",
"length":20,
"width":21,
"height":22,
"weight":12,
"packer_id":5
}
]
}
Example Outputs
{
"message":"Success"
}
{
"message":"Success"
}
Add Items
Add item information to an existing order
URI
Test - https://packitdev.tricolopstechnology.ca/addItems
Live - https://packit.tricolopstechnology.ca/addItems
Input Parameters
username
|
string, mandatory API key username |
password
|
string, mandatory API key password |
order_id
|
string, mandatory A unique identifier for the order that the items are associated with |
shipment_id |
string, optional A unique identifier for the shipment that the package are associated with If the shipment_id is provided, the combination of order_id and shipment_id must already exists by prior calls to Create Order or Add Shipments. If the shipment_id is not provided, the items will be associated with all shipments within the order |
package_id |
string, optional A unique identifier for the package that the items are associated with If the package_id is provided, the combination of order_id, shipment_id, and package_id must already exists by prior calls to Create Order, Add Shipments, or Add Packages. If the package_id is not provided, the items will be associated with all packages within the order |
items
|
array, mandatory |
item_id |
string, mandatory A unique identifier for the item in the inventory |
qty
|
number, mandatory The amount of items that is packed into the package, shipment, or order |
Output Parameters
error_message |
string "Success" on a successful order creation, otherwise describes the cause of the error |
|
|
Example Inputs
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"order_id":"O348",
"shipment_id":"O348_1",
"package_id":"O348_1_1",
"items":[
{
"item_id":"1337",
"qty":9
},
{
"item_id":"1991",
"qty":5
}
]
}
Example Outputs
{
"message":"Success"
}
Get Box Suggestion
Get the suggested package to use for packing the order
URI
Test - https://packitdev.tricolopstechnology.ca/getBoxSuggestion
Live - https://packit.tricolopstechnology.ca/getBoxSuggestion
Input Parameters
username
|
string, mandatory API key username |
||
password
|
string, mandatory API key password |
|
|
items
|
array, mandatory |
||
sku |
string, mandatory A unique identifier for the item in the inventory |
||
qty
|
number, mandatory The amount of items that needs to be packed into the order |
Output Parameters
error_message |
string "Success" on a successful order creation, otherwise describes the cause of the error |
packages |
array of packages |
length |
number Length of packages |
width |
number Width of packages |
height |
number Height of packages |
weight |
number Weight of packages |
packer_id |
string The unique identifier of the person that mostly likely know how to pack the order |
Example Inputs
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"items":[
{
"item_id":"1337",
"qty":10
},
{
"item_id":"1991",
"qty":4
}
]
}
{
"username":"ACME",
"password":"HVZ5T68AE1WF",
"items":[
{
"item_id":"5000",
"qty":10
},
{
"item_id":"1000",
"qty":4
}
]
}
Example Outputs
{
"message":"Success",
"packages":[
"length":10,
"width":11,
"height":12,
"weight":10,
"packer_id":5
]
}
{
"message":"No suggestion"
}