Difference between revisions of "API Variation"

From Spiffy Stores Knowledge Base

(Created page with "The Spiffy Stores API Variation object represents a product variation. A variation usually represents some physical version of a product that needs to be represented separatel...")
 
Line 24: Line 24:
  
 
== Variation Properties ==
 
== Variation Properties ==
 +
 +
<html>
 +
  <style type="text/css">
 +
  table.wikitable td { padding: 10px 20px !important; text-align: left; vertical-align: middle; }
 +
  </style>
 +
</html>
 +
{| class="wikitable" style="width: 100%"
 +
|style="width: 30%"|id
 +
|<code>{ "id" : 12345 }</code><br/>
 +
A unique numeric identifier for the variation.
 +
|-
 +
|product_id
 +
|<code>{ "product_id" : 123456789 }</code><br/>
 +
The unique numeric identifier for the product.
 +
|-
 +
|title
 +
|<code>{ "title" : "Red/Wool" }</code><br/>
 +
The title of the product variation.
 +
|-
 +
|position
 +
|<code>{ "position" : 1 }</code><br/>
 +
The position of the variation in the list of all product variantions. Position number 1 is at the top of the list.
 +
|-
 +
|sku
 +
|<code>{ "sku" : "P123456REDW" }</code><br/>
 +
A unique identifier for the product variation, normally used for stock tracking purposes.
 +
|-
 +
|barcode
 +
|<code>{ "barcode" : "1234567809" }</code><br/>
 +
The barcode, which is usually the UPC or ISBN number for the product variation.
 +
|-
 +
|price
 +
|<code>{ "price" : 49.95 }</code><br/>
 +
The price of the product variation.
 +
|-
 +
|wholesale_price
 +
|<code>{ "wholesale_price" : 29.95 }</code><br/>
 +
The wholesale price of the product variation. This price is used whenever a customer with the wholesale attribute logs in to the store.
 +
|-
 +
|}
 +
 +
 +
 
 +
 +
 +
  :compare_at_price => variation.compare_at_price,
 +
  :discount => variation.discount,
 +
  :taxable => !variation.tax_free,
 +
  :instalments => variation.instalments,
 +
  :grams => variation.weight_in_grams,
 +
  :length => variation.length_in_cms,
 +
  :width => variation.width_in_cms,
 +
  :height => variation.height_in_cms,
 +
  :inventory_quantity => variation.inventory_quantity,
 +
  :old_inventory_quantity => variation.inventory_quantity,
 +
  :inventory_policy => variation.inventory_policy,
 +
  :inventory_management => variation.inventory_management,
 +
  :fulfilment_service => variation.fulfilment_service,
 +
  :shipping_code => variation.shipping_code,
 +
  :free_shipping => variation.free_shipping,
 +
  :requires_shipping => !variation.no_shipping_required,
 +
  :ship_separately => variation.ship_separately,
 +
  :created_at => variation.created_at,
 +
  :updated_at => variation.updated_at

Revision as of 14:30, 20 November 2014

The Spiffy Stores API Variation object represents a product variation. A variation usually represents some physical version of a product that needs to be represented separately from other variations. Each product variation can have its inventory tracked separately.

You can view a product's variations, update them, create new ones, and delete them.

Accessing a Product

If you want to refer to a single Product then you will need to use the unique id that has been assigned to that object.

The object ids are internally generated by the software and cannot be created or assigned.

Alternatively, you may specify the object handle in place of the object id when requesting access to the object. The handle is the unique character string that is assigned to every product when it is created. The handle is used in the URL to display the product page.

For example, you may retrieve a product's variations in two ways.

GET /api/products/12345678/variations.json

or

GET /api/products/cute-dog/variations.json

The advantage of using the handle form of the request is that you don't need to search all the products first in order to determine the product id, as you will already know what the handle is. This will reduce the number of API calls that you need to make and greatly simplifies the amount of coding that is needed to manage your products.

Variation Properties

id { "id" : 12345 }

A unique numeric identifier for the variation.

product_id { "product_id" : 123456789 }

The unique numeric identifier for the product.

title { "title" : "Red/Wool" }

The title of the product variation.

position { "position" : 1 }

The position of the variation in the list of all product variantions. Position number 1 is at the top of the list.

sku { "sku" : "P123456REDW" }

A unique identifier for the product variation, normally used for stock tracking purposes.

barcode { "barcode" : "1234567809" }

The barcode, which is usually the UPC or ISBN number for the product variation.

price { "price" : 49.95 }

The price of the product variation.

wholesale_price { "wholesale_price" : 29.95 }

The wholesale price of the product variation. This price is used whenever a customer with the wholesale attribute logs in to the store.



 :compare_at_price => variation.compare_at_price,
 :discount => variation.discount,
 :taxable => !variation.tax_free,
 :instalments => variation.instalments,
 :grams => variation.weight_in_grams,
 :length => variation.length_in_cms,
 :width => variation.width_in_cms,
 :height => variation.height_in_cms,
 :inventory_quantity => variation.inventory_quantity,
 :old_inventory_quantity => variation.inventory_quantity,
 :inventory_policy => variation.inventory_policy,
 :inventory_management => variation.inventory_management,
 :fulfilment_service => variation.fulfilment_service,
 :shipping_code => variation.shipping_code,
 :free_shipping => variation.free_shipping,
 :requires_shipping => !variation.no_shipping_required,
 :ship_separately => variation.ship_separately,
 :created_at => variation.created_at,
 :updated_at => variation.updated_at