Returns all the units of measure.
Admin SDKAdmin.api('commerce.units-of-measure.find', request, function(response) { … });
HTTP POST/api/v10/commerce.units-of-measure.find
{
"conditions" : { // returns the units of measure …
"after" : 2 // … with identifier after this value - int(0…)
},
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "code", "name", … ], // fields to return - string
"order" : [ "name" ], // sort order of returned units of measure, can contain "id", "-id", "code", "-code", "name", "-name",
// "showName", "-showName", "decimalPlaces" and "-decimalPlaces" - string
"limit" : 2, // maximum number of units of measure to return - int(1…)
"first" : 30 // index of the first unit of measure to return - int(0…)
}
{
"status" : "ok",
"unitsOfMeasure" : [ {
"id" : 3, // identifier - int(1…255)
"code" : "MQ", // code - string(0…32)
"name" : { // name - string(2) -> string(0…32)
"en" : "Kg",
"it" : "Kg",
…
},
"showName" : true, // indicates if the name should be displayed after prices - bool
"decimalPlaces" : 2 // decimal places of the quantity that a customer can order - int(0…2)
}, … ]
}
Returns a unit of measure given its identifier.
Admin SDKAdmin.api('commerce.units-of-measure.get', request, function(response) { … });
HTTP POST/api/v10/commerce.units-of-measure.get
{
"id" : 15, // identifier of the unit of measure (required) - int(1…255)
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "code", "name", … ] // fields to return - string
}
{
"status" : "ok",
"unitsOfMeasure" : {
"id" : 3, // identifier - int(1…255)
"code" : "MQ", // code - string(0…32)
"name" : { // name - string(2) -> string(0…32)
"en" : "Kg",
"it" : "Kg",
…
},
"showName" : true, // indicates if the name should be displayed after prices - bool
"decimalPlaces" : 2 // decimal places of the quantity that a customer can order - int(0…2)
}
}
Number of units of measure that meet the given conditions.
Admin SDKAdmin.api('commerce.units-of-measure.count', request, function(response) { … });
HTTP POST/api/v10/commerce.units-of-measure.count
{
"conditions" : { // counts the units of measure …
"after" : 2 // … with identifier after this value - int(0…)
}
}
{
"status" : "ok",
"count" : 18 // number of units of measure - int(0…255)
}
Creates a new unit of measure.
Admin SDKAdmin.api('commerce.units-of-measure.create', request, function(response) { … });
HTTP POST/api/v10/commerce.units-of-measure.create
{
"unitOfMeasure" : { // unit of measure to create (required)
"code" : "KG", // code - string(1…32)
"name" : { // name - string(2) -> string(0…32)
"en" : "Kg",
"it" : "Kg",
…
},
"showName" : true, // indicates if the name should be displayed after prices - bool
"decimalPlaces" : 2 // decimal places of the quantity that a customer can order - int(0…2)
}
{
"status" : "ok",
"id" : 15 // identifier of the new unit of measure - int(1…255)
}
Field | Type | Description |
---|---|---|
unitOfMeasure | InvalidValue | Can not create more than 255 units of measure |
Updates a unit of measure. Any fields left out of the request will remain unchanged.
Admin SDKAdmin.api('commerce.units-of-measure.update', request, function(response) { … });
HTTP POST/api/v10/commerce.units-of-measure.update
{
"id" : 15, // identifier of the unit of measure to update (required) - int(1…255)
"unitOfMeasure" : { // unit of measure to update (required)
"code" : "KG", // code - string(1…32)
"name" : { // name - string(2) -> string(0…32)
"en" : "Kg",
"it" : "Kg",
…
},
"showName" : true, // indicates if the name should be displayed after prices - bool
"decimalPlaces" : 2 // decimal places of the quantity that a customer can order - int(0…2)
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
id | NotFound | Unit if measure <id> does not exist |
Deletes one or more units of measure.
Admin SDKAdmin.api('commerce.units-of-measure.delete', request, function(response) { … });
HTTP POST/api/v10/commerce.units-of-measure.delete
{
"ids" : [ 15, 6, … ] // identifiers of the units of measure to delete (required) - int(1…255)
}
{
"status" : "ok"
}