Supported Formats

json

Errors

Code Description
401 Unauthorized. Include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
403 Forbidden. The request was a valid request, but the server is refusing to respond to it. 403 error semantically means "unauthorized", i.e. the user does not have the necessary permissions for the resource.
404 Not Found. The requested resource could not be found.
422 Unprocessable Entity. The request was well-formed but was unable to be followed due to semantic errors.
500 Internal Server Error. An unexpected condition was encountered.

Examples

request:
  {
    "attribute_definition": {
        "name": "Test",
        "code": "test",
        "base_type": "string"
    }
  }

response:
  {
    "id": 8,
    "base_type": "string",
    "name": "Test",
    "select_options": null,
    "code": "test",
    "product_levels": []
  }

Params

Param name Description
attribute_definition
required

Validations:

  • Must be a Hash

attribute_definition[name]
required

Name of the attribute

Validations:

  • Must be a String

attribute_definition[code]
required

Unique identifier for the attribute

Validations:

  • Must be a String

attribute_definition[base_type]
required

Data type of the attribute

Validations:

  • Must be one of: string, text, html, boolean, number, list, map, single_select, multi_select, url, datetime, json, single_option, multi_option, single_npc_association, multi_npc_association.

attribute_definition[description]
optional , nil allowed

Description of the attribute

Validations:

  • Must be a String

attribute_definition[min_length]
optional , nil allowed

Minimum length

Validations:

  • Must be a Integer

attribute_definition[max_length]
optional , nil allowed

Maximum length

Validations:

  • Must be a Integer

attribute_definition[mandatory]
optional , nil allowed

If this field is true, the product must have non-blank value for this attribute

Validations:

  • Must be one of: true, false, 1, 0.

attribute_definition[completeness]
optional , nil allowed

If this field is true, the product use the attribute for completeness check

Validations:

  • Must be a String

attribute_definition[pattern]
optional , nil allowed

Ruby regular expression syntaxed string to enforce the format of the value

Validations:

  • Must be a String

attribute_definition[datetime_from]
optional , nil allowed

Date range lower bound restriction for datetime attribute

Validations:

  • Must be a String

attribute_definition[datetime_to]
optional , nil allowed

Date range upper bound restriction for datetime attribute

Validations:

  • Must be a String

attribute_definition[select_options]
optional , nil allowed

Select options for ‘single_select’ and ‘multi_select’. Must be provided if ‘base_type’ is ‘single_select’ or ‘multi_select’

Validations:

  • Must be an array of String

attribute_definition[product_level_ids]
optional , nil allowed

List of product level IDs that the attribute belongs to. Do not provide if ‘product_levels’ is provided

Validations:

  • Must be an array of Integer

attribute_definition[product_levels]
optional

List of product levels that the attribute belongs to. Do not provide if ‘product_level_ids’ is provided

Validations:

  • Must be an Array of nested elements

attribute_definition[product_levels][name]
required

Name of the product level

Validations:

  • Must be a String

attribute_definition[product_levels][attribute_set_name]
required

Name of the attribute set that the product level belongs to

Validations:

  • Must be a String

attribute_definition[option_values]
optional

List of option values that apply to this attribute definition.

Validations:

  • Must be an Array of nested elements

attribute_definition[option_values][name]
required

Option value

Validations:

  • Must be a String

attribute_definition[option_values][code]
required

Option value code

Validations:

  • Must be a String

attribute_definition[option_values][position]
optional

Position of the option value. Warning: Drag and drop sorting from UI might change the position you have set.

Validations:

  • Must be a Integer

attribute_definition[npc_product_class_ids]
optional , nil allowed

List of NPC product class IDs that allowed. Only applied for base type single_npc_association and multi_npc_association.

Validations:

  • Must be an array of Integer

attribute_definition[npc_product_class_names]
optional , nil allowed

List of NPC product class Names that allowed. Only applied for base type single_npc_association and multi_npc_association.

Validations:

  • Must be an array of String

attribute_definition[npc_product_class_mode]
optional , nil allowed

Update mode for NPC product class. Default is reset.

Validations:

  • Must be one of: add, reset.

attribute_definition[data_quality_calculation]
optional , nil allowed

If this field is true, the product use the attribute for the data quality calculation.

Validations:

  • Must be a String