Update attribute
const url = 'https://catalog.shopgate.io/v1/merchants/example/attributes/example';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"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"}}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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" }
]
}
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”Locale code to change the language of the name, descriptions, properties and media
Request Body
Section titled “Request Body”object
Type of the attribute. It specifies which type the attribute value will have.
Example
textThe usage of this attribute
Example
optionLocalization object, see Entity Localization for further information.
object
Example
{ "en-us": "string in english", "de-de": "Zeichenkette auf Deutsch"}Example
2018-12-15T00:00:23.114Zobject
Unique identifier for the attribute value
Example
blackSequence id of the order of the values. The lowest number is at the top and the highest number is at the bottom.
Example
1Localization object, see Entity Localization for further information.
object
Example
{ "en-us": "string in english", "de-de": "Zeichenkette auf Deutsch"}object
Example
https://some.url || #123456Example
{ "type": "image", "value": "https://some.url"}Responses
Section titled “Responses”Successfully updated
object
object
object
Machine readable error code
Human readable error code
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
object
object
object
object
The parameter-field, that failed to validate, like “userId”
The value, that was sent, like “xxx”
Machine readable error code
Human readable error code
object
object
Machine readable error code
Human readable error code
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
object
Example
{ "code": "NotFound", "message": "Merchant not found"}One or more attribute values are used for products and cannot be replaced
object
Machine readable error code
Human readable error code
Additional machine readable information about failing entities
object
Examplegenerated
{ "statusCode": 1, "code": "example", "message": "example", "additionalInfo": {}}
