Table of Content
Application Programming Interface (API)
Questions?
Upload Products API

The RESTful API uploads products to a warehouse catalog. This developer's guide is intended for web developers with basic knowledge of PHP, Java, C# or other programming languages.

Input Parameters

To upload products to warehouse catalog, use http://api.solvingmaze.com/catalog.

The following table summarizes the JSON input parameters.

ParameterDescription
warehouseWarehouse ID where products are uploaded to.

keyThe warehouse's secret API key.

items An array of associative arrays. Each associative array stores item attributes:
skuItem SKU
nameItem name
unitPriceDefault unit price is 0.00
weightDefault weight is 0.0001
weightUnitChoices are "kg", "g", "oz" or "lb" (default)
rotatableTrue if item can be rotated for packing
packableFalse if item is to be shipped separately
dimensionUnitChoices are "m", "cm", "mm", "ft" or "in" (default)
dimensionsAn array of associative arrays. Each associative array holds a possible packing dimension, e.g. {"length": 8, "width": 7, "height": 5}. Default values are 0.0001.

All attributes are optional except for SKU.

If an item with the given SKU already exists in the warehouse catalog, then its attributes will be replaced by the attributes in the request. However, if the item does not already exist, then it will be added to the catalog. Furthermore, any missing attributes in the request will assume their default values.

An example parameter value is:

[
	{
		"sku": "101",
		"name": "Jacket",
		"unitPrice": 25.40,
		"weight": 0.7,
		"weightUnit": "lb",
		"rotatable": true,
		"packable": true,
		"dimensionUnit": "in",
		"dimensions":
		[
			{
				"length": 12,
				"width": 11,
				"height": 1,
			},
			{
				"length": 10,
				"width": 8,
				"height": 2,
			}
		]
	}
]
Response

The JSON response consists of a status associative array with the following attributes:

AttributeDescription
successA boolean flag indicating whether upload was successful.

messagesIn the case of failure, an array of status messages may be returned.

PHP Integration Example

The following example uploads an item to a warehouse catalog. If the item already exists in the catalog, then its attributes will be replaced with the item attributes in the request.

<?php

$item = array(
	'sku' => '101',
	'name' => 'Shirt',
	'unitPrice' => 10.75,
	'weight' => 0.3,
	'weightUnit' => 'lb',
	'rotatable' => true,
	'packable' => true,
	'dimensionUnit' => 'in',
);
$dimensions = array();
$dimensions[] = array('length'=>11, 'width'=>9, 'height'=>1);
$item["dimensions"] = dimensions;

$params = array(
	"warehouse" => json_encode($myWarehouseId),
	"key" => json_encode($myApiKey),
	"items" => json_encode(array($items)),
);

$ch = curl_init("http://api.solvingmaze.com/catalog");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

?>