The Lead Commerce SKUs API allows you to view, and update skus. If you are looking to view stock levels and adjust inventory, please review the Stock Level API.
Views allow you to display data about your SKUs.
With the SKU API, you can filter your result set to get a particular result set you are looking for. You can use any of the filters in any particular combination.
Filters
Key | Data Type | Required | Example | Notes |
---|---|---|---|---|
status | Integer | No | 1 |
|
id | Integer | No | 5 | The ID of the Product |
product_type | Integer | No | 1 | The ID of the Product Yype |
timestamp_start | Integer | No | 1406239561 | UNIX timestamp of the latest time of the product. This means updated or created. |
timestamp_end | Integer | No | 1412200562 | UNIX timestamp of the latest time of the product. This means updated or created. |
price_above | Integer | No | 8 | Price of the product above this watermark. |
price_below | Integer | No | 100 | Price of the product below this watermark. |
The sample code below demonstrates how to request a view in XML:
Example:
<?php header("Content-type: text/xml;"); $credentials = array('identifier' => 'LC350000000', 'key' => 'dynKSr4I7y2K3RrPRsFYFJr03IXUbv'); $curl = curl_init(); curl_setopt($curl,CURLOPT_POSTFIELDS, http_build_query($credentials)); curl_setopt($curl,CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, 'http://leadcommercestore.web/api/v1/SKUs.xml'); curl_exec($curl); curl_close($curl); ?>
Example Output:
<?xml version="1.0" encoding="UTF-8"?> <message client="192.168.100.128" time="1412201790"> <response> <code>200</code> <data> <item> <sku>1-0012</sku> <product_name>Basic T-Shirt</product_name> <price>22.99</price> <cost>8.95</cost> <length>0.00</length> <width>0.00</width> <height>0.00</height> <weight>1.75</weight> <weight_only>Y</weight_only> <ship_alone>N</ship_alone> <disable_backorder>N</disable_backorder> <status>Active</status> <vendors> <vendor> <vendor>1</vendor> </vendor> </vendors> <product_variations> <product_variation> <id>1</id> <name>2XL</name> </product_variation> </product_variations> </item> <item> <sku>1-0011</sku> <product_name>Basic T-Shirt</product_name> <price>22.99</price> <cost>8.95</cost> <length>0.00</length> <width>0.00</width> <height>0.00</height> <weight>1.75</weight> <weight_only>Y</weight_only> <ship_alone>N</ship_alone> <disable_backorder>N</disable_backorder> <status>Active</status> <vendors> <vendor> <vendor>1</vendor> </vendor> </vendors> <product_variations> <product_variation> <id>1</id> <name>3XL</name> </product_variation> </product_variations> </item> </data> </response> </message>
Create allows you to update SKUs and their values as if you went through the Lead Commerce Back Office.
Example:
$update = array("id" => "X4545RL0-998", "cost" => "19.95", "price" => "34.95", "length" => "12", "width" => "36", "height" => "8", "weight" => "2.2", "weight_only" => "Y", "ship_alone" => "N", "status" => "active", "vendors" => array(1, 3), "warehouses" => array(array('id'=>1,'warn'=>16,'location'=>'B45')), "conditions" => array(array('id'=>16, 'condition'=>1, 'expiration'=>'9/12/2014','location'=>541))); $fields = array('identifier' => 'LC350000000', 'key' => 'dynKSr4I7y2K3RrPRsFYFJr03IXUbv', 'updates' => array($update)); $curl = curl_init(); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($fields)); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, 'http://www.leadcommercestore.com/api/v1/Products/create.xml'); curl_exec($curl); curl_close($curl); ?>
Key | Data Type | Required | Example | Notes |
---|---|---|---|---|
id |
string |
No |
X4545RL0-998 |
Only available if Custom SKU is enabled. This must be a unique string. |
status |
string |
No |
Active |
Active by default |
cost |
decimal |
Yes |
19.95 |
Enter amount in US Dollars |
price |
decimal |
Yes |
34.95 |
Enter amount in US Dollars |
attributes |
|
|
|
Please review Attributes API documentation |
weight_only |
boolean |
No |
Y |
|
ship_alone |
boolean |
No |
N |
|
length |
Integer |
No |
12 |
Enter in Inches (in) |
width |
Integer |
No |
36 |
Enter in Inches (in) |
height |
Integer |
No |
8 |
Enter in Inches (in) |
weight |
decimal |
Yes |
2.2 |
Enter in Pounds (lbs) |
vendors |
array |
No |
1081, 605, 984 |
ID from Vendors |
Key | Data Type | Required | Example | Notes |
---|---|---|---|---|
id | Integer | Yes |
1
|
ID of the warehouse |
warn | Integer | No | 10 | Minimum Stock Warning. |
location | string | No | Shelf v57 |
|
The conditions of the block
asdfad
Key | Data Type | Required | Example | Notes |
---|---|---|---|---|
id | Integer | Yes |
16
|
ID of the Inventory block or batch |
condition | Integer | No | 10 |
2 Like New 3 Used 4 Used-Like New 5 Used-Very Good 6 Used-Good 7 Used-Acceptable 8 Expired 9 Refurbished 10 Collectable 11 Vintage |
expiration | string | No | 9/12/2014 | The expiration of the product |
location | string | No | Shelf v57 |
|