Returns the attribute values that meet the given conditions.
Admin SDKAdmin.api('commerce.attribute-values.find', request, function(response) { … });
HTTP POST/api/v10/commerce.attribute-values.find
{
"conditions" : { // returns the attribute values …
"ids" : [ 46, 19, … ], // … with these identifiers - int(1…)
"attributes" : [ 81, 22, … ], // … that belong to these attributes (id) - int(1…)
"after" : 9 // … with identifier after this value - int(0…)
},
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "code", … ], // fields to return - string
"order" : [ "name" ], // sort order of returned attribute values, can contain "id", "-id", "attribute", "-attribute", "code", "-code",
// "name", "-name", "position" and "-position" - string
"limit" : 10, // maximum number of attribute values to return - int(1…)
"first" : 0 // index of the first attribute value to return - int(0…)
}
{
"status" : "ok",
"values" : [ {
"id" : 46, // identifier - int(1…)
"attribute" : 81, // attribute (id) - int(1…)
"code" : "RED", // code - string(1…32)
"name" : { // name - string(2) -> string(0…60)
"en" : "Red",
"it" : "Rosso",
…
},
"description" : { // description - string(2) -> string(0…1000)
"en" : "...",
"it" : "...",
…
},
"canonicalURL" : { // canonical URL - string(2) -> string(10…)
"en" : "https://www.site.com/Red",
"it" : "https://www.site.com/it/Rosso",
…
},
"position" : 3, // position - int(1…)
"icon" : { // icon (can be null)
"color" : null, // color, hexadecimal format (can be null) - string(6)
"image" : { // image (can be null)
"url" : "https://…", // image URL - string(10…)
"width" : 16, // width in pixel - int(1…100)
"height" : 16 // height in pixel - int(1…100)
}
}
}, … ]
}
Returns an attribute value given its identifier.
Admin SDKAdmin.api('commerce.attribute-values.get', request, function(response) { … });
HTTP POST/api/v10/commerce.attribute-values.get
{
"id" : 46, // identifier of the attribute value (required) - int(1…)
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "code", "name", … ] // fields to return - string
}
{
"status" : "ok",
"value" : { // (can be null)
"id" : 46, // identifier - int(1…)
"attribute" : 81, // attribute (id) - int(1…)
"code" : "RED", // code - string(1…32)
"name" : { // name - string(2) -> string(0…60)
"en" : "Red",
"it" : "Rosso",
…
},
"description" : { // description - string(2) -> string(0…1000)
"en" : "...",
"it" : "...",
…
},
"canonicalURL" : { // canonical URL - string(2) -> string(10…)
"en" : "https://www.site.com/Red",
"it" : "https://www.site.com/it/Rosso",
…
},
"position" : 3, // position - int(1…)
"icon" : { // icon (can be null)
"color" : null, // color, hexadecimal format (can be null) - string(6)
"image" : { // image (can be null)
"url" : "https://…", // image URL - string(10…)
"width" : 16, // width in pixel - int(1…100)
"height" : 16 // height in pixel - int(1…100)
}
},
"products" : [ 281, 89, … ] // products (id) that have this attribute value - int(1…)
}
}
Number of attribute values that meet the given conditions.
Admin SDKAdmin.api('commerce.attribute-values.count', request, function(response) { … });
HTTP POST/api/v10/commerce.attribute-values.count
{
"conditions" : { // returns the attribute values …
"ids" : [ 46, 19, … ], // … with these identifiers - int(1…)
"attributes" : [ 81, 22, … ], // … that belong to these attributes (id) - int(1…)
"after" : 9 // … with identifier after this value - int(0…)
}
}
{
"status" : "ok",
"count" : 12 // number of attribute values - int(0…)
}
Creates a new attribute value.
Admin SDKAdmin.api('commerce.attribute-values.create', request, function(response) { … });
HTTP POST/api/v10/commerce.attribute-values.create
{
"value" : { // attribute value to create (required)
"attribute" : 81, // attribute (id) (required) - int(1…)
"code" : "RED", // code (required) - string(1…32)
"name" : { // name - string(2) -> string(0…60)
"en" : "Red",
"it" : "Rosso",
…
},
"description" : { // description - string(2) -> string(0…1000)
"en" : "...",
"it" : "...",
…
},
"position" : 3, // position - int(1…)
"icon" : { // icon (can be null)
"color" : null, // color, hexadecimal format (can be null) - string(6)
"image" : { // image (can be null)
"name" : "icon.png", // file name - string(1…255)
"content" : "N3R…zaA==" // content encoded in base64 - string(100…50000)
}
}
}
}
{
"status" : "ok",
"id" : 43 // identifier of the new attribute value - int(1…)
}
Field | Type | Description |
---|---|---|
attribute | NotFound | Attribute <attribute> does not exist |
code | AlreadyExists | Attribute value code '<code> ' already exists for attribute <attribute> |
icon | Malformed | '<color> ' is not a valid hexadecimal color |
icon | Malformed | 'color' or 'image' are required |
icon | Malformed | Both 'color' and 'image' can not be in an icon |
image | Malformed | Image format '<format> ' is not supported |
image | Malformed | Image is corrupted or is not an image |
image | Malformed | Image size can not be greater than 100 KB |
image | Malformed | Image width and height must be less than 100 pixels |
Updates an attribute value. Any fields left out of the request will remain unchanged.
Admin SDKAdmin.api('commerce.attribute-values.update', request, function(response) { … });
HTTP POST/api/v10/commerce.attribute-values.update
{
"id" : 43, // identifier of the attribute value to update (required)
"value" : { // attribute value's fields to update (required)
"code" : "RED", // code - string(1…32)
"name" : { // name - string(2) -> string(0…60)
"en" : "Red",
"it" : "Rosso",
…
},
"description" : { // description - string(2) -> string(0…1000)
"en" : "...",
"it" : "...",
…
},
"position" : 3, // position - int(1…)
"icon" : { // icon (can be null)
"color" : null, // color, hexadecimal format (can be null) - string(6)
"image" : { // image (can be null)
"name" : "icon.png", // file name - string(1…255)
"content" : "N3R…zaA==" // content encoded in base64 - string(100…50000)
}
},
"products" : [ 281, 89, … ] // products (id) that have this attribute value - int(1…)
}
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
code | AlreadyExists | Attribute value code '<code> ' already exists for attribute <attribute> |
icon | Malformed | '<color> ' is not a valid hexadecimal color |
icon | Malformed | 'color' or 'image' are required |
icon | Malformed | Both 'color' and 'image' can not be in an icon |
id | NotFound | Attribute value <id> does not exist |
image | Malformed | Image format '<format> ' is not supported |
image | Malformed | Image is corrupted or is not an image |
image | Malformed | Image size can not be greater than 100 KB |
image | Malformed | Image width and height must be less than 100 pixels |
products | InvalidValue | Product id does not exist |
products | InvalidValue | Product id has the attribute as variant |
products | Malformed | A product id is repeated |
Deletes one or more attribute values.
Admin SDKAdmin.api('commerce.attribute-values.delete', request, function(response) { … });
HTTP POST/api/v10/commerce.attribute-values.delete
{
"ids" : [ 43, 25, 108, … ] // identifiers of the attribute values to delete (required) - int(1…)
}
{
"status" : "ok"
}