Returns the attributes that meet the given conditions.
Admin SDKAdmin.api('commerce.attributes.find', request, function(response) { … });
HTTP POST/api/v10/commerce.attributes.find
{
"conditions" : { // returns only the attributes …
"ids" : [ 81, … ], // … with these identifiers - int(1…)
"after" : 55 // … 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 attributes, can contain "id", "-id", "code", "-code", "name" and "-name" - string
"limit" : 10, // maximum number of attributes to return - int(1…)
"first" : 0 // index of the first attribute to return - int(0…)
}
{
"status" : "ok",
"attributes" : [ {
"id" : 81, // identifier - int(1…)
"code" : "SHIRT COLOR", // code - string(1…32)
"position" : 3, // position - int(1…)
"name" : { // name - string(2) -> string(0…60)
"en" : "Color",
"it" : "Colore",
…
},
"showName" : true // indicates if the name should be displayed
}, … ]
}
Returns an attribute given its identifier.
Admin SDKAdmin.api('commerce.attributes.get', request, function(response) { … });
HTTP POST/api/v10/commerce.attributes.get
{
"id" : 81, // identifier of the attribute (required) - int(1…)
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "code", … ] // fields to return - string
}
{
"status" : "ok",
"attribute" : { // (can be null)
"id" : 81, // identifier - int(1…)
"code" : "SHIRT COLOR", // code - string(1…32)
"position" : 3, // position - int(1…)
"name" : { // name - string(2) -> string(0…60)
"en" : "Color",
"it" : "Colore",
…
},
"showName" : true // indicates if the name should be displayed
}
}
Number of attributes that meet the given conditions.
Admin SDKAdmin.api('commerce.attributes.count', request, function(response) { … });
HTTP POST/api/v10/commerce.attributes.count
{
"conditions" : { // counts only the attributes …
"ids" : [ 81, … ], // … with these identifiers - int(1…)
"after" : 55 // … with identifier after this value - int(0…)
}
}
{
"status" : "ok",
"count" : 89 // number of attributes - int(0…)
}
Creates a new attribute.
Admin SDKAdmin.api('commerce.attributes.create', request, function(response) { … });
HTTP POST/api/v10/commerce.attributes.create
{
"attribute" : {
"code" : "SHIRT COLOR", // code (required) - string(1…32)
"position" : 3, // position - int(1…)
"name" : { // name - string(2) -> string(0…60)
"en" : "Color",
"it" : "Colore",
…
},
"showName" : true // indicates if the name should be displayed
}
}
{
"status" : "ok",
"id" : 81 // identifier of the new attribute - int(1…)
}
Updates an attribute. Any fields left out of the request will remain unchanged.
Admin SDKAdmin.api('commerce.attributes.update', request, function(response) { … });
HTTP POST/api/v10/commerce.attributes.update
{
"id" : 81, // identifier of the attribute to update (required) - int(1…)
"attribute" : { // attribute's fields to update (required)
"code" : "SHIRT COLOR", // code - string(1…32)
"position" : 3, // position - int(1…)
"name" : { // name - string(2) -> string(0…60)
"en" : "Color",
"it" : "Colore",
…
},
"showName" : true // indicates if the name should be displayed
}
}
{
"status" : "ok"
}
field | Type | Description |
---|---|---|
id | NotFound | Attribute <id> does not exist |
Deletes one or more attributes.
Admin SDKAdmin.api('commerce.attributes.delete', request, function(response) { … });
HTTP POST/api/v10/commerce.attributes.delete
{
"ids" : [ 81, 12, 33, … ] // identifiers of the attributes to delete (required) - int(1…)
}
{
"status" : "ok"
}