Variant

Contain data reffered to Product Variant. In availability_type are allowed values: 'own', 'hours', 'days', 'weeks', 'months'.


Receive a list of all Product Variants

Query parameters:
  • fields - list of fields returning in response
GET /services/variants/{product_id}

Returns all variants

HTTP/1.1 200 OK
{
	"variants": [
		{
			"id" : "9",
			"uuid" : "775775f9-31f1-4335-8eed-c62dbdd4649d",
			"product_id" : "4",
			"sku" : "315122-056",
			"property_name_1" : "40",
			"property_name_2" : "Black",
			"property_name_3" : "",
			"price" : "2000",
			"price_regular" : "2000",
			"quantity" : "15",
			"weight" : "800",
			"add_to_magazine" : "1",
			"magazine_group" : "1",
			"buy_if_empty" : "0",
            "thumbnail" : "https://localhost/shoplo/static/0001/products/th640/aaab/127-image-1.jpg",
			"availability" : "0",
            "availability_description" : "1-2 weeks",
            "availability_type" : "own",
			"barcode" : "123456789",
			"created_at" : "2011-11-06 19:55:26",
			"updated_at" : "2011-11-06 19:55:26",
			"title" : "NIKE AIR FORCE 1 07",
            "position" : 1
		},
		{
			"id" : "10",
			"uuid" : "55701143-df57-4cc6-9dc0-3bab4093b483",
			"product_id" : "4",
			"sku" : "315122-058",
			"property_name_1" : "42",
			"property_name_2" : "Black",
			"property_name_3" : "",
			"price" : "2000",
			"price_regular" : "2000",
			"quantity" : "10",
			"weight" : "800",
			"add_to_magazine" : "0",
			"magazine_group" : "0",
			"buy_if_empty" : "1",
            "thumbnail" : "https://localhost/shoplo/static/0001/products/th640/bdwe/164-image-1.jpg",
			"availability" : "1",
            "availability_description" : "12",
            "availability_type" : "days",
			"barcode" : "123456789",
            "created_at" : "2011-11-06 19:56:03",
			"updated_at" : "2011-11-06 19:56:03",
			"title" : "NIKE AIR FORCE 1 07",
            "position" : 2
		},
	]
}

Receive a count of all Variants

GET /services/products/{product_id}/variants/count

Receive a count of all Variants

HTTP/1.1 200 OK
{
	"count": 12
}

Receive a single Variant

Query parameters:
  • fields - list of fields returning in response
GET services/products/{product_id}/variants/{id}

Receive a single Variant

Response
HTTP/1.1 200 OK
{
	"variant": {
		"id" : "10",
		"uuid" : "92774ea3-d4ef-40f9-851c-d6e739dd1a1a",
		"product_id" : "4",
		"sku" : "315122-058",
		"property_name_1" : "42",
		"property_name_2" : "Black",
		"property_name_3" : "",
		"price" : "2000",
		"price_regular" : "2000",
		"quantity" : "10",
		"weight" : "800",
		"add_to_magazine" : "0",
		"magazine_group" : "0",
		"buy_if_empty" : "1",
        "thumbnail" : "https://localhost/shoplo/static/0001/products/th640/aaab/123-image-1.jpg",
		"availability" : "1",
        "availability_description" : "24",
        "availability_type" : "hours",
		"barcode" : "123456789",
        "created_at" : "2011-11-06 19:56:03",
		"updated_at" : "2011-11-06 19:56:03",
		"title" : "NIKE AIR FORCE 1 07",
        "position" : 1
	},
}

Create a Variant

POST services/products/{product_id}/variants

Create variant with specified parameters

Request
{
	"variant": {
		"sku" : "315122-060",
		"property_1" : "Size",
		"property_name_1" : "44",
		"property_2" : "Color
		"property_name_2" : "Black",
		"price" : "2100",
		"price_regular" : "2100",
		"quantity" : "10",
		"weight" : "800",
		"magazine_group" : "0",
		"buy_if_empty" : "1",
		"availability" : "1",
        "availability_description" : "1-2 weeks",
        "availability_type" : "own",
		"barcode" : "123456789",
    },
}
Response
HTTP/1.1 200 OK
{
	"variant": {
		"id" : "12",
		"uuid" : "aaeb7f2b-1e37-483b-afb3-e9d73bf16e5d",
		"product_id" : "4",
		"sku" : "315122-060",
		"property_name_1" : "44",
		"property_name_2" : "Black",
		"property_name_3" : "",
		"price" : "2100",
		"price_regular" : "2100",
		"quantity" : "10",
		"weight" : "800",
		"add_to_magazine" : "0",
		"magazine_group" : "0",
		"buy_if_empty" : "1",
        "thumbnail" : "https://localhost/shoplo/static/0001/products/th640/aadb/127-image-1.jpg",
		"availability" : "1",
        "availability_description" : "1-2 weeks",
        "availability_type" : "own",
		"barcode" : "123456789",
		"created_at" : "2011-11-06 19:59:03",
		"updated_at" : "2011-11-06 19:59:03",
		"title" : "NIKE AIR FORCE 1 07",
        "position" : 1
	},
}

Update an existing Variant

PUT services/products/{product_id}/variants/{id}

You can update such things as: title, sku, price_regular, price, weight, quantity, buy_if_empty, add_to_magazine, magazine_group, property_name1, property_name2, property_name3.

Request
{
	"variant": {
		"price" : "1800",
	},
}
Response
HTTP/1.1 200 OK
{
	"variant": {
		"id" : "10",
		"uuid" : "a41b675b-24de-4282-9963-f3d4eeebd75f",
		"product_id" : "4",
		"sku" : "315122-058",
		"property_name_1" : "42",
		"property_name_2" : "Green",
		"property_name_3" : "",
		"price" : "1800",
		"price_regular" : "1800",
		"quantity" : "10",
		"weight" : "800",
		"add_to_magazine" : "0",
		"magazine_group" : "0",
		"buy_if_empty" : "1",
        "thumbnail" : "https://localhost/shoplo/static/0001/products/th640/aaab/127-image-1.jpg",
		"availability" : "1",
        "availability_description" : "1-2 weeks",
        "availability_type" : "own",
		"barcode" : "123456789",
		"created_at" : "2011-11-06 19:56:03",
		"updated_at" : "2011-11-06 19:56:03",
		"title" : "NIKE AIR FORCE 1 07",
        "position" : 1
	},
}

Delete an existing Variant

DELETE services/products/{product_id}/variants/{id}

Delete an existing Variant of product

Response
HTTP/1.1 200 OK
{
	"status"	: "ok",
}