Create attributes
const url = 'https://catalog.shopgate.io/v1/merchants/example/attributes';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"attributes":[{"code":"color","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 \ --header 'Content-Type: application/json' \ --data '{ "attributes": [ { "code": "color", "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" } } ] } ] }'Add new attributes.
Localizations
The following properties are localized:
- name
- values[].name
see Entity Localization for further information.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Body
Section titled “Request Body”object
object
Example
colorType 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”All attributes were created
object
object
object
Machine readable error code
Human readable error code
Example
{ "errors": [ { "code": 400, "entity": "planet", "entityId": "pluto", "entityIndex": 1, "reason": "Planet pluto was not found (did you mean dwarf planet pluto?)", "subentityPath": [ "categories", 0 ], "validationErrors": [ { "code": "MAX_LENGTH", "message": "Name too long", "description": "Property Name is too long", "path": [ "name" ] } ] } ]}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 not found
object
Example
{ "code": "NotFound", "message": "Merchant not found"}
