Open2b versione 7.5

customer-groups

customer-groups.find

Returns the customer groups that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.customer-groups.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.customer-groups.find
{
  "conditions" : { // returns only the customer groups …
    "isDefault" : false, // … that are the default customer group or not - bool
    "after" : 5 // … with identifier after this value - int(0…255)
  },
  "fields" : [ "id", "code", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned customer groups, can contain "id", "-id", "name", "-name", "list", "-list",
                        // "sale", "-sale", "allowOrders", "-allowOrders", "allowQuotes", "-allowQuotes", "taxArea", "-taxArea",
                        // "includeTaxes" and "-includeTaxes" - string
  "limit" : 10, // maximum number of customer groups to return - int(1…255)
  "first" : 30 // index of the first customer group to return - int(0…)
}

Response

{
  "status" : "ok",
  "groups" : [ {
    "id" : 3, // identifier - int(1…255)
    "code" : "RESELLERS", // code - string(0…40)
    "name" : "Resellers", // name - string(0…60)
    "list" : 1, // list price list (id) (can be null) - int(1…255)
    "sale" : 2, // sale price list (id) - int(1…255)
    "collection" : 8, // collection (id) - int(1…)
    "discountList" : false, // indicates if promotion discounts are applied to the list price - bool
    "allowOrders" : true, // indicates if orders are allowed - bool
    "minOrder" : 100.00, // minimum subtotal allowed for an order - decimal[10,2](0…)
    "maxOrder" : 5000.00, // maximum subtotal allowed for an order - decimal[10,2](0…)
    "allowQuotes" : false, // indicates if quotes are allowed - bool
    "paymentMethods" : [ 3, 7, … ], // payment methods that can be chosen in an order (can be null) - int(1…)
    "shippingMethods" : [ 2, 4, … ], // shipping methods that can be chosen in an order (can be null) - int(1…)
    "taxArea" : 7, // tax area (id) - int(1…)
    "includeTaxes" : true, // indicates if prices are displayed tax included to customers - bool
    "isDefault" : false // indicates if it is the default customer group - bool
  }, … ]
}

customer-groups.get

Returns a customer group given its identifier.

Request

Admin SDK
Admin.api('commerce.customer-groups.get', request, function(response) { … });
HTTP POST
/api/v10/commerce.customer-groups.get
{
  "id" : 3, // identifier of the customer group to return (required) - int(1…255)
  "fields" : [ "id", "code", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "group" : {
    "id" : 3, // identifier - int(1…255)
    "code" : "RESELLERS", // code - string(0…40)
    "name" : "Resellers", // name - string(0…60)
    "list" : 1, // list price list (id) (can be null) - int(1…255)
    "sale" : 2, // sale price list (id) - int(1…255)
    "collection" : 8, // collection (id) - int(1…)
    "discountList" : false, // indicates if promotion discounts are applied to the list price - bool
    "allowOrders" : true, // indicates if orders are allowed - bool
    "minOrder" : 100.00, // minimum subtotal allowed for an order - decimal[10,2](0…)
    "maxOrder" : 5000.00, // maximum subtotal allowed for an order - decimal[10,2](0…)
    "allowQuotes" : false, // indicates if quotes are allowed - bool
    "paymentMethods" : [ 3, 7, … ], // payment methods that can be chosen in an order (can be null) - int(1…)
    "shippingMethods" : [ 2, 4, … ], // shipping methods that can be chosen in an order (can be null) - int(1…)
    "taxArea" : 7, // tax area (id) - int(1…)
    "includeTaxes" : true, // indicates if prices are displayed tax included to customers - bool
    "isDefault" : false // indicates if it is the default customer group - bool
  }
}

customer-groups.count

Number of customer groups that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.customer-groups.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.customer-groups.count
{
  "conditions" : { // counts only the customer groups …
    "isDefault" : false, // … that are the default customer group or not - bool
    "after" : 5 // … with identifier after this value - int(0…255)
  }
}

Response

{
  "status" : "ok",
  "count" : 7 // number of customer groups - int(0…255)
}

customer-groups.create

Create a new customer group.

Request

Admin SDK
Admin.api('commerce.customer-groups.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.customer-groups.create
{
  "group" : { // customer group to create (required)
    "code" : "RESELLERS", // code - string(0…40)
    "name" : "Resellers", // name - string(0…60)
    "list" : 1, // list price list (id) (can be null) - int(1…255)
    "sale" : 2, // sale price list (id) (required) - int(1…255)
    "collection" : 8, // collection (id) (required) - int(1…)
    "discountList" : false, // indicates if promotion discounts are applied to the list price - bool
    "allowOrders" : true, // indicates if orders are allowed - bool
    "minOrder" : 100.00, // minimum subtotal allowed in an order - decimal[10,2](0…)
    "maxOrder" : 5000.00, // maximum subtotal allowed in an order - decimal[10,2](0…)
    "allowQuotes" : false, // indicates if quotes are allowed - bool
    "paymentMethods" : [ 3, 7, … ], // payment methods that can be chosen in an order (can be null) - int(1…)
    "shippingMethods" : [ 2, 4, … ], // shipping methods that can be chosen in an order (can be null) - int(1…)
    "taxArea" : 7, // tax area (id) - int(1…)
    "includeTaxes" : true, // indicates if prices are displayed tax included to customers - bool
    "isDefault" : false // indicates if it is the default customer group - bool
  }
}

Response

{
  "status" : "ok",
  "id" : 3 // identifier of the new customer group - int(1…255)
}

Errors

Field Type Description
code AlreadyExists Code '<code>' already exists
code Malformed '<code>' has trailing spaces
collection NotFound Collection <collection> does not exist
group LimitReached Maximum limit of customer groups has been reached
list NotFound Price list <list> does not exist
maxOrder InvalidValue Maximum order cannot be set because orders are not allowed
maxOrder InvalidValue Maximum order must be greater than or equal to minimum order
minOrder InvalidValue Minimum order cannot be set because orders are not allowed
paymentMethods Malformed A payment method id is repeated
paymentMethods Malformed There must be no more than 20 payment methods
paymentMethods NotAvailable Group's payment methods are not available for this installation
paymentMethods NotFound Payment method <paymentMethod> does not exist
sale InvalidValue Sale cannot be the same price list of list
sale NotFound Price list <sale> does not exist
shippingMethods Malformed A shipping method id is repeated
shippingMethods Malformed There must be no more than 20 shipping methods
shippingMethods NotAvailable Group's shipping methods are not available for this installation
shippingMethods NotFound Shipping method <shippingMethod> does not exist
taxArea NotFound Tax area <taxArea> does not exist

customer-groups.update

Updates a customer group. Any fields left out of the request will remain unchanged.

Request

Admin SDK
Admin.api('commerce.customer-groups.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.customer-groups.update
{
  "id" : 3, // identifier of the customer group to update (required) - int(1…255)
  "group" : { // customer group's fields to update (required)
    "code" : "RESELLERS", // code - string(0…40)
    "name" : "Resellers", // name - string(0…60)
    "list" : 1, // list price list (id) (can be null) - int(1…255)
    "sale" : 2, // sale price list (id) - int(1…255)
    "collection" : 8, // collection (id) - int(1…)
    "discountList" : false, // indicates if promotion discounts are applied to the list price - bool
    "allowOrders" : true, // indicates if orders are allowed - bool
    "minOrder" : 100.00, // minimum subtotal allowed in an order - decimal[10,2](0…)
    "maxOrder" : 5000.00, // maximum subtotal allowed in an order - decimal[10,2](0…)
    "allowQuotes" : false, // indicates if quotes are allowed - bool
    "paymentMethods" : [ 3, 7, … ], // payment methods that can be chosen in an order (can be null) - int(1…)
    "shippingMethods" : [ 2, 4, … ], // shipping methods that can be chosen in an order (can be null) - int(1…)
    "taxArea" : 7, // tax area (id) - int(1…)
    "includeTaxes" : true, // indicates if prices are displayed tax included to customers - bool
    "isDefault" : false // indicates if it is the default customer group - bool
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
code AlreadyExists Code '<code>' already exists
code Malformed '<code>' has trailing spaces
collection NotFound Collection <collection> does not exist
id NotFound Customer group <id> does not exist
isDefault InvalidValue Cannot unset 'isDefault' of the default group
list NotFound Price list <list> does not exist
maxOrder InvalidValue Maximum order cannot be set because orders are not allowed
maxOrder InvalidValue Maximum order must be greater than or equal to minimum order
minOrder InvalidValue Minimum order cannot be set because orders are not allowed
paymentMethods Malformed A payment method id is repeated
paymentMethods Malformed There must be no more than 20 payment methods
paymentMethods NotAvailable Group's payment methods are not available for this installation
paymentMethods NotFound Payment method <paymentMethod> does not exist
sale InvalidValue Sale cannot be the same price list of list
sale NotFound Price list <sale> does not exist
shippingMethods Malformed A shipping method id is repeated
shippingMethods Malformed There must be no more than 20 shipping methods
shippingMethods NotAvailable Group's shipping methods are not available for this installation
shippingMethods NotFound Shipping method <shippingMethod> does not exist
taxArea NotFound Tax area <taxArea> does not exist

customer-groups.delete

Deletes one or more customer groups.

Request

Admin SDK
Admin.api('commerce.customer-groups.delete', request, function(response) { … });
HTTP POST
/api/v10/commerce.customer-groups.delete
{
  "ids" : [ 3, 7, … ] // identifiers of the customer groups to delete (required) - int(1…255)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
ids InvalidValue Default customer group <id> cannot be deleted
ids Malformed A customer group identifier is repeated