An object representing a customer group. Customer groups are accessible to administrators only.
Property | Description |
---|---|
uid | The unique identifier of the customer group. |
name | Name of the customer group. |
changed | Date and time of when the customer group was last modified. If never modified, the value will be that of when the customer group was created. |
created | Date and time of when the customer group was created. |
Takes a filter object and returns the number of customer groups found, as an integer.
A filter object specifying which customer groups to count. See Filter objects on the page List selection.
The request below returns the number of customer groups found where the name in English starts with "Staff"
.
Customergroup.count({
"/name": {
"startsWith": "Staff"
}
})
Creates a new customer group. This is a shorthand for set with null
as the first parameter.
Parameter | Description |
---|---|
patch | An object containing the properties and values to set for the new customer group. |
query | A query specifying what to return after customer-group creation has been successful (optional). See Query language. |
The request below creates a customer group with the name "Students"
and returns the name and unique identifier of the customer group.
Customergroup.create({
"name": "Students"
}, [
"uid",
"name"
])
Fetches information about a customer group.
Parameter | Description |
---|---|
uid | The unique identifier of a customer group. |
query | Which info to return. See Query language. |
The request below returns the name of the customer group with the unique identifier 123123
.
Customergroup.get(123123, "name")
Fetches the JSON Schema which can be used for client-side validation.
The unique identifier of an existing customer group or null
for a new customer group.
Returns an array of objects representing customer groups.
Parameter | Description |
---|---|
query | A query object specifying what to fetch from each customer group. This is the same as for get. See Query language. |
selection | A list selection specifying which customer groups to fetch. See List selection. |
These orderings are available:
The following request returns an array of max two customer groups with the properties name, created, changed and uid:
Customergroup.list([
"uid",
"name",
"changed",
"created"
], {
"limit": 2
})
Creates or updates a customer group.
Parameter | Description |
---|---|
uid | The unique identifier of a customer group to update or null to create a new customer group. |
patch | An object containing the properties and values to set for the customer group. |
query | A query specifying what to return after a successful set (optional). See Query language. |
The request below changes the name of the customer group with the unique identifier 123123
and returns the properties name, changed, created and uid of the customer group.
Customergroup.set(123123, {
"name": "Students and teachers"
}, [
"uid",
"name",
"changed",
"created"
])
Validates the data to be set. The performed validation is the same as in set; it validates the resulting object and includes all the required properties. However, nothing is saved.
Parameter | Description |
---|---|
uid | The unique identifier of an existing customer group or null . |
patch | An object containing the properties and values to set before validating. |
An array of validation-error objects, each containing the keys pointer
(a property referenced using a JSON Pointer) and message
(a readable text in the language of the context). If there are no validation errors, then an empty array is returned.