API Documentation

In-depth reference documentation for iQmetrix API's.

NAV

OVERVIEW

The Shipping Aggregator requests shipping options from a vendosr’s shipping API and returns a list of their associated costs and timeframe.

The Shipping Aggregator also verifies the availability of the requested catalog items. If an item is Out of Stock, then you must prevent this order from continuing. An unavailable item will be indicated in the body of an HTTP 400 response.

ENDPOINTS

Sandbox: https://shippingaggregatordemo.iqmetrix.net/
Production: https://shippingaggregator.iqmetrix.net/

RESOURCES

ShippingQuery

{
    "LocationEntityId": "14202",
    "PostalCode": "P9H 9I4",
    "Items": [
        {
            "CatalogId": "18e039de-f950-4d8e-a48a-d06e4db55a07",
            "Quantity": 1,
            "Cost": 9.99
        }
    ]
}
Name Description
LocationEntityId (String) Location identifer
PostalCode (String) Postal or zip code of shipping address
Items (Array[Item]) List of Products to be added to shipping query

Item

{
    "CatalogId": "18e039de-f950-4d8e-a48a-d06e4db55a07",
    "Quantity": 1,
    "Cost": 9.99
}
Name Description
CatalogId (GUID) Catalog identifer
Quantity (Integer) Amount of products
Cost (Decimal) Cost of item

ShippingResponse

{
    "Id": 1,
    "LocationEntityId": 14202,
    "PostalCode": "P9H 9I4",
    "Shipments": [
        {
            "SupplierEntityId": 14107,
            "Items": [
                {
                    "CatalogId": "18e039de-f950-4d8e-a48a-d06e4db55a07",
                    "Quantity": 1,
                    "Cost": 9.99
                }
            ],
            "ShippingOptions": [
                {
                    "Id": "1",
                    "Cost": 7.94,
                    "Currency": "CAD",
                    "EstimatedTransitTime": "1 week",
                    "Name": "PurolatorExpress"
                }
            ]
        }
    ]
}
Name Description  
Id (Integer) Unique identifer  
LocationEntityId (Integer) Location identifier  
PostalCode (String) Postal or zip code of shipping address  
Shipments (Array[Shipments]) List of suppliers and their shipping options  
Items (Array[object]) Reserved for internal use  

Shipments

{
    "SupplierEntityId": 14107,
    "Items": [
        {
            "CatalogId": "18e039de-f950-4d8e-a48a-d06e4db55a07",
            "Quantity": 1,
            "Cost": 9.99
        }
    ],
    "ShippingOptions": [
        {
            "Id": "1",
            "Cost": 7.94,
            "Currency": "CAD",
            "EstimatedTransitTime": "1 week",
            "Name": "PurolatorExpress"
        }
    ]
}
Name Description
SupplierEntityId (Integer) Supplier identifier
Items (Array[Item]) List of Products to be added to shipping query
ShippingOptions (Array[ShippingOptions]) List of shipping options available from vendor

ShippingOptions

{
    "Id": "1",
    "Cost": 7.94,
    "Currency": "CAD",
    "EstimatedTransitTime": "1 week",
    "Name": "PurolatorExpress"
}
Name Description
Id (String) Vendor shipping identifer
Cost (Decimal) Cost for shipping option
Currency (String) Cost currency (USD or CAD)
EstimatedTransitTime (String) Total time to be in transit, where units are provided by supplier
Name (String) Shipping option name

REQUESTS

GET Shipping Options

Request

POST /Companies({CompanyId})/ShippingInformation

Example Request

POST /Companies(14146)/ShippingInformation
Authorization: Bearer (Access Token)
Accept: application/json
Content-Type: application/json

{
    "LocationEntityId": "14202",
    "PostalCode": "P9H 9I4",
    "Items": [
        {
            "CatalogId": "18e039de-f950-4d8e-a48a-d06e4db55a07",
            "Quantity": 1
        }
    ]
}
curl -X POST "https://shippingaggregatordemo.iqmetrix.net//Companies(14146)/ShippingInformation" -H "Authorization: Bearer (Access Token)" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
    "LocationEntityId": "14202",
    "PostalCode": "P9H 9I4",
    "Items": [
        {
            "CatalogId": "18e039de-f950-4d8e-a48a-d06e4db55a07",
            "Quantity": 1
        }
    ]
}'
static IRestResponse RetrievingShippingOptions()
{
    var client = new RestClient("https://shippingaggregatordemo.iqmetrix.net//Companies(14146)/ShippingInformation");
    var request = new RestRequest(Method.POST);
     
    request.AddHeader("Authorization", "Bearer (Access Token)"); 
    request.AddHeader("Accept", "application/json"); 
    request.AddHeader("Content-Type", "application/json"); 

     request.AddParameter("application/json", "{\"LocationEntityId\":\"14202\",\"PostalCode\":\"P9H 9I4\",\"Items\":[{\"CatalogId\":\"18e039de-f950-4d8e-a48a-d06e4db55a07\",\"Quantity\":1}]}", ParameterType.RequestBody);

    return client.Execute(request);
}
import org.apache.http.entity.StringEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;

public static CloseableHttpResponse RetrievingShippingOptions() throws IOException {
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpPost request = new HttpPost("https://shippingaggregatordemo.iqmetrix.net//Companies(14146)/ShippingInformation");
     
    request.addHeader("Authorization", "Bearer (Access Token)"); 
    request.addHeader("Accept", "application/json"); 
    request.addHeader("Content-Type", "application/json"); 
    StringEntity body = new StringEntity("{\"LocationEntityId\":\"14202\",\"PostalCode\":\"P9H 9I4\",\"Items\":[{\"CatalogId\":\"18e039de-f950-4d8e-a48a-d06e4db55a07\",\"Quantity\":1}]}");
    request.setEntity(body);
    
    return httpClient.execute(request);
}
require 'rest-client'

body = "{\"LocationEntityId\":\"14202\",\"PostalCode\":\"P9H 9I4\",\"Items\":[{\"CatalogId\":\"18e039de-f950-4d8e-a48a-d06e4db55a07\",\"Quantity\":1}]}";

response = RestClient.post 'https://shippingaggregatordemo.iqmetrix.net//Companies(14146)/ShippingInformation', body, {
     :'Authorization' => 'Bearer (Access Token)',
     :'Accept' => 'application/json',
     :'Content-Type' => 'application/json',
    } 

puts response

URI Parameters

Request Parameters

Response Parameters

Example Response

HTTP 202 Content-Type: application/json
{
    "Id": 1,
    "LocationEntityId": 14202,
    "PostalCode": "P9H 9I4",
    "Shipments": [
        {
            "SupplierEntityId": 14107,
            "Items": [
                {
                    "CatalogId": "18e039de-f950-4d8e-a48a-d06e4db55a07",
                    "Quantity": 1,
                    "Cost": 9.99
                }
            ],
            "ShippingOptions": [
                {
                    "Id": "1",
                    "Cost": 7.94,
                    "Currency": "CAD",
                    "EstimatedTransitTime": "1 week",
                    "Name": "PurolatorExpress"
                }
            ]
        }
    ]
}

ShippingResponse

ERRORS

HTTP Status Code Description How to Resolve
HTTP 400 No availability found for the following products: (Product Name) Occurs when item is no longer available.
HTTP 400 Entity is not related to company Occurs when entering an incorrect CompanyId or LocationEntityId
HTTP 400 Error getting catalog item identifiers for CatalogIds: (CatalogId) Occurs when entering an incorrect CatalogId
Was this page helpful?