TS Commerce Developers

Product Variants Attributes API

Current version: v1.1

Get product variants attributes

GET
/productvariants/list.json
Get product variants attributes Request

$storeden = new Storeden\Storeden($config);
$products_list = $storeden->get('/productvariants/list.json');
					
Get product variants attributes Response

[
	{
		"key": "color",
		"values": {
			"pink": {
				"value": "pink",
				"img": ""
			},
			"black": {
				"value": "black",
				"img": "https:\/\/tcdn.storeden.com\/gallery\/5b23c42b16f46ad5418b456e"
			},
			...
		}
	},
	...
]

Set variant value attribute image

PUT
/productvariants/variantimage.json
key required (string) Variant key (for example: color)
value required (string) Variant entry (for example: black)
image_id required (StoredenID) Unique id of image resource ( see: Gallery API )

{
    "ok": 1,
    "err": null,
    "nModified": 56
}

Get variant image gallery

GET
/productvariants/variantgallery.json
uid required (int) Unique item uid
sku required (string) Variant specific SKU
Get variant image gallery Request

$storeden = new Storeden\Storeden($config);
$products_list = $storeden->get('/productvariants/variantgallery.json?uid=1724183&SKU=red-xl-tshirt');
					
Get variant image gallery Response

{
    "uid": 1724183,
    "variant": {
        "gallery": [
            "https://egress.storeden.net/gallery/56d59a4b02e58e0370a942d5",
            "https://egress.storeden.net/gallery/56d59a4b02e58e0370a942d6",
            "https://egress.storeden.net/gallery/56d59a4b02e58e0370a942ef"
        ],
        "sku": "red-xl-tshirt"
    }
}

Set variant image gallery

PUT
/productvariants/variantgallery.json
uid required (int) Unique item uid
sku required (string) Variant specific SKU
gallery[] required (StoredenID|url) *multiple Specify full url of image or image StoredenID previously uploaded into Gallery
Set variant image gallery Request

$storeden = new Storeden\Storeden($config);

$payload = array();
$payload['uid'] = 1724183;
$payload['sku'] = 'red-xl-tshirt';
$pyaload['gallery'] = [];
$payload['gallery'][] = 'https://egress.storeden.net/gallery/56d59a4b02e58e0370a942d5';
$payload['gallery'][] = '56d59a4b02e58e0370a942d6';
$payload['gallery'][] = '56d59a4b02e58e0370a942ef';

$products_list = $storeden->put('/productvariants/variantgallery.json', $payload);
					
Set variant image gallery Response

{
    "inserted": {
        "status": {
            "ok": 1,
            "nModified": 1,
            "n": 1,
            "err": null,
            "errmsg": null,
            "updatedExisting": true
        },
        "urls": [
            "https://egress.storeden.net/gallery/56d59a4b02e58e0370a942d6",
            "https://egress.storeden.net/gallery/56d59a4b02e58e0370a942d5",
            "https://egress.storeden.net/gallery/56d59a4b02e58e0370a942ef"
        ]
    }
}

Get variants translations

GET
/productvariants/variantTranslation.json
variant required (string) Your variant name
Get variants translations Request

$storeden = new Storeden\Storeden($config);

$variant_translations = $storeden->get('/productvariants/variantTranslation.json?variant=Colore');
					
Get variants translations Response

{
    "variant": {
        "label": "Colore",
        "translations": {
            "it_IT": "Colore",
            "en_US": "Color",
            "es_ES": null
        }
    },
    "variantValues": [
        {
            "label": "rosso",
            "translations": {
                "it_IT": "Rosso",
                "en_US": "Red",
                "es_ES": null
            },
            "image": null
        },
        {
            "label": "giallo",
            "translations": {
                "it_IT": "Giallo",
                "en_US": "Yellow",
                "es_ES": null
            },
            "image": null
        },
        {
            "label": "verde",
            "translations": {
                "it_IT": "Verde",
                "en_US": "Green",
                "es_ES": null
            },
            "image": "https://tcdn.storeden.com/gallery/5b58910e16f46af008b410f0"
        },
        {
            "label": "blue",
            "translations": {
                "it_IT": null,
                "en_US": null,
                "es_ES": null
            },
            "image": null
        }
    ],
    "locales": {
        "it_IT": "Italiano",
        "en_US": "Inglese",
        "es_ES": "Spagnolo"
    }
}
				

Set variants translations

Please note that this api endpoint is currently in beta stage.
This endpoint overwrite all the translations of the specified "variant"

POST
/productvariants/variantTranslation.json
variant required (string) Your variant name
variantTranslation[TLD] required (string) Replace TLD with iso code of translated content ( eg: en_US )
variantValueTranslations[VARIANT_VALUE][image] (string) replace VARIANT_VALUE with the correct variant label
variantValueTranslations[VARIANT_VALUE][translations][TLD] (string) Replace TLD with iso code of translated content ( eg: en_US ), replace VARIANT_VALUE with the correct variant label
Set variants translations Request

$storeden = new Storeden\Storeden($config);

$payload = array();
$payload['variant'] = 'Colore';
$payload['variantTranslations'] = array(
	'it_IT' => 'Colore del prodotto',
	'en_US' => 'Product color'
);
$payload['variantValueTranslations'] = array(
	'giallo' = array(
		'image' => 'https://egress.storeden.net/gallery/111',
		'translations' => array(
			'it_IT' => 'Giallo',
			'en_US' => 'Yellow',
			'es_ES' => 'Amarillo'
		)
	),
	'rosso' = array(
		'image' => 'https://egress.storeden.net/gallery/222',
		'translations' => array(
			'it_IT' => 'Rosso',
			'en_US' => 'Red'
		)
	),
	'blue' = array(
		'image' => 'https://egress.storeden.net/gallery/333',
		'translations' => array(
			'it_IT' => 'Blu',
			'en_US' => 'Blue'
		)
	)
);

$variant_update = $storeden->post('/productvariants/variantTranslation.json', $payload);

					
Set variants translations Response

{
    "itemsCount": 2,
    "nModified": 2
}