Skip to content

Update attribute

POST
/merchants/{merchantCode}/attributes/{attributeCode}
curl --request POST \
--url https://catalog.shopgate.io/v1/merchants/example/attributes/example \
--header 'Content-Type: application/json' \
--data '{ "type": "text", "use": "option", "name": { "en-us": "string in english", "de-de": "Zeichenkette auf Deutsch" }, "externalUpdateDate": "2018-12-15T00:00:23.114Z", "values": [ { "code": "black", "sequenceId": 1, "name": { "en-us": "string in english", "de-de": "Zeichenkette auf Deutsch" }, "swatch": { "type": "image", "value": "https://some.url" } } ] }'

Update an attribute.

Localizations

The following properties are localized:

  • name
  • values[].name

see Entity Localization for further information.

Preserving attribute values

To preserve an existing attribute value pass its “code” property only.

Example to remove all values except “green” from an attribute:

{
  "values": [
    { "code": "green" }
  ]
}
merchantCode
required
string
<= 255 characters
attributeCode
required
string
<= 255 characters
localeCode
string
<= 5 characters

Locale code to change the language of the name, descriptions, properties and media

Media typeapplication/json
object
type

Type of the attribute. It specifies which type the attribute value will have.

string
Allowed values: text productList input number
Example
text
use

The usage of this attribute

string
Allowed values: option extra property
Example
option
name

Localization object, see Entity Localization for further information.

object
key
additional properties
string
>= 1 characters <= 255 characters
Example
{
"en-us": "string in english",
"de-de": "Zeichenkette auf Deutsch"
}
externalUpdateDate
null | string format: date-time
Example
2018-12-15T00:00:23.114Z
values
Array<object>
<= 5000 items
object
code
required

Unique identifier for the attribute value

string
<= 255 characters
Example
black
sequenceId

Sequence id of the order of the values. The lowest number is at the top and the highest number is at the bottom.

number
Example
1
name

Localization object, see Entity Localization for further information.

object
key
additional properties
string
>= 1 characters <= 255 characters
Example
{
"en-us": "string in english",
"de-de": "Zeichenkette auf Deutsch"
}
swatch
object
type
string
Allowed values: image color
value
string
Example
https://some.url || #123456
Example
{
"type": "image",
"value": "https://some.url"
}

Successfully updated

Media typeapplication/json
object
errors
required
Array<object>
object
code
number
entity
string
entityId
string | object
entityIndex
integer
reason
string
catalogCode
string
subentityPath
Array<string | number>
validationErrors
Array<object>
object
code

Machine readable error code

string
Allowed values: ENUM_MISMATCH MAXIMUM MAXIMUM_EXCLUSIVE MINIMUM MINIMUM_EXCLUSIVE MULTIPLE_OF ARRAY_LENGTH_LONG ARRAY_LENGTH_SHORT ARRAY_ADDITIONAL_ITEMS ARRAY_UNIQUE MAX_LENGTH MIN_LENGTH MAX_PROPERTIES MIN_PROPERTIES OBJECT_MISSING_REQUIRED_PROPERTY OBJECT_PROPERTIES_MAXIMUM OBJECT_PROPERTIES_MINIMUM OBJECT_ADDITIONAL_PROPERTIES OBJECT_DEPENDENCY_KEY ONE_OF_MISSING ONE_OF_MULTIPLE NOT_PASSED INVALID_FORMAT INVALID_CREDENTIALS INVALID_TYPE UNKNOWN_FORMAT PATTERN
message

Human readable error code

string
description
string
path
Array<string>
Example
{
"errors": [
{
"code": 409,
"entity": "attributeValue",
"entityId": "black",
"entityIndex": 0,
"reason": "Attribute value is still in use by some products",
"subentityPath": [
"values"
],
"productCodes": [
1234567
]
}
]
}

Validation error

Media typeapplication/json
object
statusCode
number
message
string
code
string
additionalInfo
object
validationErrors
Array<object>
object
code
number
reason
string
entity
string
entityId
string
subentityPath
Array<string | number>
error
object
paramName

The parameter-field, that failed to validate, like “userId”

string
paramValue

The value, that was sent, like “xxx”

null | string | number | array | object
code

Machine readable error code

string
Allowed values: SCHEMA_VALIDATION_FAILED VALIDATION_FAILED ENUM_MISMATCH MAXIMUM MAXIMUM_EXCLUSIVE MINIMUM MINIMUM_EXCLUSIVE MULTIPLE_OF ARRAY_LENGTH_LONG ARRAY_LENGTH_SHORT ARRAY_ADDITIONAL_ITEMS ARRAY_UNIQUE MAX_LENGTH MIN_LENGTH MAX_PROPERTIES MIN_PROPERTIES OBJECT_MISSING_REQUIRED_PROPERTY OBJECT_PROPERTIES_MAXIMUM OBJECT_PROPERTIES_MINIMUM OBJECT_ADDITIONAL_PROPERTIES OBJECT_DEPENDENCY_KEY ONE_OF_MISSING ONE_OF_MULTIPLE NOT_PASSED INVALID_FORMAT INVALID_TYPE UNKNOWN_FORMAT PATTERN
message
required

Human readable error code

string
results
object
errors
Array<object>
object
code

Machine readable error code

string
Allowed values: ENUM_MISMATCH MAXIMUM MAXIMUM_EXCLUSIVE MINIMUM MINIMUM_EXCLUSIVE MULTIPLE_OF ARRAY_LENGTH_LONG ARRAY_LENGTH_SHORT ARRAY_ADDITIONAL_ITEMS ARRAY_UNIQUE MAX_LENGTH MIN_LENGTH MAX_PROPERTIES MIN_PROPERTIES OBJECT_MISSING_REQUIRED_PROPERTY OBJECT_PROPERTIES_MAXIMUM OBJECT_PROPERTIES_MINIMUM OBJECT_ADDITIONAL_PROPERTIES OBJECT_DEPENDENCY_KEY ONE_OF_MISSING ONE_OF_MULTIPLE NOT_PASSED INVALID_FORMAT INVALID_CREDENTIALS INVALID_TYPE UNKNOWN_FORMAT PATTERN
message

Human readable error code

string
description
string
path
Array<string>
warnings
array
Example
{
"error": {
"code": "SCHEMA_VALIDATION_FAILED",
"results": {
"errors": [
{
"code": "MAX_LENGTH",
"message": "Name too long",
"description": "Property Name is too long",
"path": [
"name"
]
}
]
}
}
}

Merchant or attribute not found

Media typeapplication/json
object
statusCode
number
code
required
string
message
required
string
Example
{
"code": "NotFound",
"message": "Merchant not found"
}

One or more attribute values are used for products and cannot be replaced

Media typeapplication/json
object
statusCode
number
code

Machine readable error code

string
message
required

Human readable error code

string
additionalInfo

Additional machine readable information about failing entities

object
Examplegenerated
{
"statusCode": 1,
"code": "example",
"message": "example",
"additionalInfo": {}
}