Catalog.getAttributes

Request the Catalog attributes and their options from the shop system.

This method is called during Sync Agent update. Attributes in SC database will be updated to data of the response.

Request

JSON Example

[
  {
      "api":1,
      "method":"auth",
      "params":{
         "username":"...",
         "password":"..."
      },
      "id":1
   },
   {
    "api": 1,
    "method": "Catalog.getAttributes",
    "params": {},
    "id": 1
  }
]

Response

Response sends all global attributes and their options (use Catalog.getAttributeSets to retrieve attributes grouped in sets):

Uniqueness

It's allowed to have only one attribute with the fields: "productType": "simple" and "uniqueValue": "config". The attribute with these values will be treated as unique attribute to distinguish variations (simples).

[
  {
    "api": 1,
    "result": [
      {
        "attributeId": 10,
        "globalIdentifier": "global id of #10",
        "name": "name of the attribute #10",
        "label": "label of the attribute #10",
        "description": "description of the attribute #10",
        "productType": "type of product",
        "attributeType": "type of attribute",
        "maxLength": 20,
        "decimalPlaces": 2,
        "defaultValue": "default value of the attribute #10",
        "uniqueValue": "unique value of the attribute #10",
        "inputType": "type of input",
        "inputMode": "mode of input",
        "validation": "validation",
        "mandatory": true,
        "mandatoryImport": false,
        "options": [
          {
            "optionId": 100,
            "globalIdentifier": "global id #100",
            "name": "name of the option #100",
            "position": 0,
            "isDefault": true
          },
          {
            "optionId": 101,
            "globalIdentifier": "global id #101",
            "name": "name of the option #101",
            "position": 1,
            "isDefault": false
          }
        ]
      },
      {
        "attributeId": 11,
        "globalIdentifier": "global id of #11",
        "name": "name of the attribute #11",
        "label": "label of the attribute #11",
        "description": "description of the attribute #11",
        "productType": "type of product",
        "attributeType": "type of attribute",
        "maxLength": 20,
        "decimalPlaces": 2,
        "defaultValue": "default value of the attribute #11",
        "uniqueValue": "unique value of the attribute #11",
        "inputType": "type of input",
        "inputMode": "mode of input",
        "validation": "validation",
        "mandatory": true,
        "mandatoryImport": false,
        "options": [
          {
            "optionId": 110,
            "globalIdentifier": "global id #110",
            "name": "name of the option #110",
            "position": 0,
            "isDefault": true
          },
          {
            "optionId": 111,
            "globalIdentifier": "global id #111",
            "name": "name of the option #111",
            "position": 1,
            "isDefault": false
          }
        ]
      }
    ]
  }
]

Make sure values are properly encoded in the types specified below, as the Sync Agent client will not do any automatic conversion. Using strings instead of integers (eg.: "42" instead of 42), or integers instead of booleans (1 instead of true) will result in a validation error during sync.

Attributes' fields:

Field name

Type

Mandatory

Description

attributeId

integer

yes

id of the attribute in the Shop system

globalIdentifier

varchar(255)

no

identifier of the attribute, unique across all country databases for your Shop system 1)

name

varchar(255)

yes

internal name of the attribute

label

varchar(255)

yes

visible name of the attribute

description

text

no

optional description of the attribute

productType

enum ('config', 'simple', 'source')

yes

type of product this attribute applies to

attributeType

enum ('system', 'option', 'multi_option', 'value', 'custom')

yes

type of attribute

maxLength

integer

no

maximum length of attribute value

decimalPlaces

integer

no

maximum number of decimal places for numeric attribute value

defaultValue

varchar(255)

no

default value of the attribute

uniqueValue

enum ('global', 'config')

no

scope of uniqueness of attribute's values

inputType

enum ('textfield', 'textarea', 'numberfield', 'datefield', 'datetime', 'checkbox', 'dropdown', 'multiselect', 'combo', 'multicombo', 'pricecost')

yes

type of input to render for edit form; corresponds to "pet_type" column in the Shop system

inputMode

enum ('edit', 'display', 'invisible', 'editoncreate')

no

visibility options for input; corresponds to "pet_mode" column in the Shop system

validation

enum ('decimal', 'integer', 'percent', 'letters', 'lettersnumbers', 'material-attribute', 'material-option')

no

validation type for edit form

mandatory

boolean

yes

whether the attribute is required for products

mandatoryImport

boolean

no

whether the attribute is required during import

options

array of options

no

Only for attributeType "option" or "multi_option"

Attribute options' fields:

Field Name

Type

Mandatory

Description

optionId

integer

yes

id of the attribute option in the Shop system

globalIdentifier

varchar(255)

no

identifier of the attribute, unique across all country databases for your Shop system 1)

name

varchar(255)

yes

name of the option

position

integer

no

position of the option

isDefault

boolean

no

whether this is a default option for the attribute

1) not used by all shop systems