Product Types

Product types are used to describe common characteristics, most importantly common custom attributes, of many concrete products.

Please note: to customize other resources than products, please refer to types.

Representations

ProductType

ProductTypeDraft

AttributeDefinition

Attribute definitions describe a product attribute and allow you to define some meta-information associated with the attribute (like whether it should be searchable or its constraints).

AttributeDefinitionDraft

AttributeDefinitionDrafts specify the product attribute to be created with the ProductTypeDraft

AttributeType

All attribute types have a name. Some have additional fields such as values in enums or elementType in sets.

BooleanType

Valid values for the attribute are true and false (JSON Boolean).

TextType

LocalizableTextType

EnumType

LocalizableEnumType

NumberType

MoneyType

DateType

TimeType

DateTimeType

ReferenceType

SetType

The set attribute type defines a set (array without duplicates) with values of the given elementType. It does not support isRequired.

NestedType beta

The nested attribute type allows you to nest attributes based on some existing product type. It does not support isSearchable nor it is supported in queries at the moment. The only supported AttributeConstraint is None.

The value of the nested attribute is an array of values. It reflects the structure of the attributes property of product variant, where every element of array is a JSON object with properties name and value.

Here is an example of nested attribute value in product variant:

{
  ...
  "attributes": [
    {"name": "nutrients", "value": [
      {"name": "servingSize", "value": 100},
      {"name": "servingSizeUnits", "value": "GR" }
    ]}
  ]
  ...
}

It is also possible to declare a set of nested attribute type:

{
  "name": "productTypeWithNestedSet",
  "type": {
    "name": "set",
    "elementType": {
      "name": "nested",
      "typeReference": {
        "id": "<id-nested-product-type>",
        "typeId": "product-type"
      }
    }
  }
}

To get more information about NestedTypes please consult our tutorial dedicated to this.

TextInputHint

A text input hint is a string with one of the following values:

PlainEnumValue

LocalizedEnumValue

AttributeConstraint Enum

AttributeConstraint enum tells how an attribute or a set of attributes should be validated across all variants of a product:

Get a ProductType

Get a ProductType by ID

Endpoint: /{projectKey}/product-types/{id}
Method: GET
OAuth2 Scopes: view_products:{projectKey}
Response Representation: ProductType

Get a ProductType by Key

Endpoint: /{projectKey}/product-types/key={key}
Method: GET
OAuth2 Scopes: view_products:{projectKey}
Response Representation: ProductType

Query ProductTypes

Endpoint: /{projectKey}/product-types
Method: GET
OAuth2 Scopes: view_products:{projectKey}
Response Representation: PagedQueryResult with the results array of ProductType
Query Parameters:

Create a ProductType

Endpoint: /{projectKey}/product-types
Method: POST
OAuth2 Scopes: manage_products:{projectKey}
Request Representation: ProductTypeDraft
Response Representation: ProductType

Update ProductType

Update ProductType by ID

Endpoint: /{projectKey}/product-types/{id}
Method: POST
OAuth2 Scopes: manage_products:{projectKey}
Response Representation: ProductType
Fields:

Update ProductType by Key

Endpoint: /{projectKey}/product-types/key={key}
Method: POST
OAuth2 Scopes: manage_products:{projectKey}
Response Representation: ProductType
Fields:

Update Actions
Please find below the individual update actions provided on this endpoint.


Set Key

Change Name

Change Description

Add AttributeDefinition

Remove AttributeDefinition

Remove an attribute definition.
This removal also deletes all corresponding attributes on all Products with this product type. The removal of the attributes is eventually consistent.

Change AttributeDefinition Label

Set AttributeDefinition InputTip

Allows to set additional information about the specified attribute that aids content managers when setting product details.

Add PlainEnumValue to AttributeDefinition

Adds an enum to the values of EnumType. It can update an EnumType attribute definition or a Set of EnumType attribute definition.

Add LocalizableEnumValue to AttributeDefinition

Adds an localizable enum to the values of LocalizableEnumType. It can update a LocalizableEnum attribute definition or a Set of LocalizableEnumType attribute definition.

Remove EnumValues from AttributeDefinition

Removes enum values from an attribute definition of EnumType or LocalizableEnumType or Set of EnumType or Set of LocalizableEnum.
All attributes of all products using those enum keys will also be removed in an eventually consistent way.

Change the order of AttributeDefinitions

Change the order of EnumValues

This action changes the order of enum values in an EnumType attribute definition. It can update an EnumType attribute definition or a Set of EnumType attribute definition.

Change the order of LocalizedEnumValues

This action changes the order of localized enum values in a LocalizableEnumType attribute definition. It can update a LocalizableEnumType attribute definition or a Set of LocalizableEnumType attribute definition.

Change the label of an EnumValue

This action changes the label of a single enum value in an EnumType attribute definition. It can update an EnumType attribute definition or a Set of EnumType attribute definition. All products will be updated to the new label in an eventually consistent way.

Change the label of a LocalizedEnumValue

This action changes the label of a single enum value in a LocalizableEnumType attribute definition. It can update a LocalizableEnumType attribute definition or a Set of LocalizableEnumType attribute definition. All products will be updated to the new label in an eventually consistent way.

Change AttributeDefinition IsSearchable

Following this update the products are reindexed asynchronously to reflect this change on the search endpoint. When enabling search on an existing attribute type definition, the constraint regarding the maximum size of a searchable attribute will not be enforced. Instead, product attribute definitions exceeding this limit will be treated as not searchable and will not be available for full-text search.

Change AttributeDefinition InputHint

This action will update the inputHint of an AttributeDefinition.

Delete ProductType

This request deletes a product type only if it’s not referenced by a product.

Delete ProductType by ID

Endpoint: /{projectKey}/product-types/{id}
Method: DELETE
OAuth2 Scopes: manage_products:{projectKey}
Query Parameters:

Delete ProductType by Key

Endpoint: /{projectKey}/product-types/key={key}
Method: DELETE
OAuth2 Scopes: manage_products:{projectKey}
Query Parameters: