Difference between revisions of "API Variation"

From Spiffy Stores Knowledge Base

Line 40: Line 40:
 
|-
 
|-
 
|title
 
|title
|<code>{ "title" : "Red/Wool" }</code><br/>
+
|<code>{ "title" : "Red/Wool/Small" }</code><br/>
 
The title of the product variation.
 
The title of the product variation.
 
|-
 
|-
Line 46: Line 46:
 
|<code>{ "position" : 1 }</code><br/>
 
|<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.
 
The position of the variation in the list of all product variantions. Position number 1 is at the top of the list.
 +
|-
 +
|option1
 +
|<code>{ "option1" : "Red" }</code><br/>
 +
A product can have up to 3 options. Each variation will have a unique combination of option values. This is the value of option 1.
 +
|-
 +
|option2
 +
|<code>{ "option2" : "Wool" }</code><br/>
 +
A product can have up to 3 options. Each variation will have a unique combination of option values. This is the value of option 2.
 +
|-
 +
|option3
 +
|<code>{ "option3" : "Small" }</code><br/>
 +
A product can have up to 3 options. Each variation will have a unique combination of option values. This is the value of option 3.
 
|-
 
|-
 
|sku
 
|sku
|<code>{ "sku" : "P123456REDW" }</code><br/>
+
|<code>{ "sku" : "P123456REDWS" }</code><br/>
 
A unique identifier for the product variation, normally used for stock tracking purposes.
 
A unique identifier for the product variation, normally used for stock tracking purposes.
 
|-
 
|-

Revision as of 09:33, 21 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/Small" }

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.

option1 { "option1" : "Red" }

A product can have up to 3 options. Each variation will have a unique combination of option values. This is the value of option 1.

option2 { "option2" : "Wool" }

A product can have up to 3 options. Each variation will have a unique combination of option values. This is the value of option 2.

option3 { "option3" : "Small" }

A product can have up to 3 options. Each variation will have a unique combination of option values. This is the value of option 3.

sku { "sku" : "P123456REDWS" }

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 { "compare_at_price" : 69.95 }

This price is used to show the regular price of a variation to highlight how much is being saved.

discount { "discount" : 5.00 }

This is the amount that this variation can have as a discount when it is eligible for a shopping cart discount. This amount overrides any general discount calculation for the cart.

taxable { "taxable" : true }

Indicates whether the product variation is subject to tax. Some items, such as food or books may be exempt from taxes such as GST or VAT.

instalments { "instalments" : 1 }

If instalments are enabled for this product, then this indicates the number of instalments that must be paid for this variation.

grams { "grams" : 200 }

The weight of the product variation in grams.

length { "length" : 100 }

The length of the product variation in cms.

width { "width" : 50 }

The width of the product variation in cms.

height { "height" : 20 }

The height of the product variation in cms.

inventory_quantity { "inventory_quantity" : 10 }

The number of items in stock for this product variation.

old_inventory_quantity { "old_inventory_quantity" : 10 }

The original number of items in stock for this product variation. This value must be provided when attempting to update the inventory quantity. If the old_inventory_quantity no longer matches the actual inventory quantity because the value has been updated elsewhere, then the attempt to update the quantity will fail and should be retried.

inventory_quantity_adjustment { "inventory_quantity_adjustment" : 5 }

If it is not important to determine the exact level of the inventory quantity, then an adjustment can be used instead to increment or decrement the inventory quantity by a certain amount.

inventory_management { "inventory_management" : "spiffy" }

Specifies whether or not Spiffy Stores tracks the number of items in stock for this product variation. Valid values are:

  • blank: Inventory for this product variation is not tracked.
  • spiffy: Inventory tracking is enabled for this product variation.
inventory_policy { "inventory_policy" : "continue" }

Specifies whether or not customers are allowed to place an order for a product variation when it's out of stock. Valid values are:

  • deny (default): Customers are not allowed to place orders for a product variation when it's out of stock.
  • continue: Customers are allowed to place orders for a product variation when it's out of stock.
  • archive: The product is hidden when the variation is out of stock, and customers are not allowed to place orders for the variation.
fulfilment_service { "fulfilment_service" : "manual" }

If orders are fulfilled by the store itself, then this is 'manual'. Otherwise the value is set to the fulfilment service that has been enabled for this product variation.

shipping_code { "shipping_code" : "BULK_ITEM" }

If a special shipping rate is required for this product variation, it is specified by the 'shipping_code'. This shipping rate overrides the default shipping rate for the destination.

free_shipping { "free_shipping" : false }

Indicates that this product variation is eligible for free shipping.

requires_shipping { "requires_shipping" : true }

Indicates that this product variation is a physical object that requires shipping.

ship_separately { "ship_separately" : false }

Indicates that the item is bulky and cannot be added to the total cart weight for the shipping rate calculation. The item is assessed for shipping as an individual parcel, based on its weight and dimensions which are required for separate shipping.

created_at { "created_at" : "2007-10-24T18:26:31Z" }

The date and time when the product variation was created. The timestamp is in ISO 8601 format.

updated_at { "updated_at" : "2014-01-16T05:50:56Z" }

The date and time when the product variation was last updated. The timestamp is in ISO 8601 format.