Attributes

The Attributes Import Endpoint

https://{BASE_URL}/imports/attributes

All import integration endpoints use the same authentication parameters, please see Authentication page for more details.

Like the Product Import, this endpoint uses Import Queues to handle all imported data.

You may post any amount of Attributes to the endpoint. Existing attributes are overwritten based on their id.

JSON Example

[
    {
        "id": "country",
        "name": { "da": "Land", "en": "Country" },
        "type": {
            "options": {
                "denmark": {
                    "id": "denmark",
                    "name": { "da": "Danmark", "en": "Denmark" }
                },
                "france": {
                    "id": "france",
                    "name": { "da": "Frankrig", "en": "France" }
                }
            }
        }
    },
    {
        "id" : "length",
        "name" : "Length (meters)",
        "type" : {
            "number" : {
                "scale" : 0,
                "suffix" : " m"
            }
        }
    },
    {
        "id" : "note",
        "name" : "Note",
        "type" : {
            "text": {
                "text":  true
            }
        }
    },
    ...
]

Models

The attribute model looks like this

{
    "id": "<string, required>",
    "name": "<L10nString, required>",
    "type": "<Attribute type, required>"
}

L10nString is a localized string.

There are 3 types of attributes

  • options
  • number
  • text

The simplest is the text type. Since we just need to specify that the attribute is a free text attribute, we just need a presence in the json.

{
    "text": {
        "text":  true
    }
}

For the number type you need to specify a decimal scale and a suffix that can be used in presentation. The suffix can be an empty string if you don't need any.

{
    "number" : {
        "scale" : "<integer, should be 0, 1, 2 or 3>",
        "suffix" : "<string>"
    }
}

The options attribute type specifies a set of text options that a product can use.

{
    "options": {
        "denmark": {
            "id": "<string, required, must be equal to object key (denmark)>",
            "name": "<L10nString, required>"
        },
        "france": {
            "id": "<string, required, must be equal to object key (france)>",
            "name": "<L10nString, required>"
        }
    }
}

L10nString is a localized string.

Shared Integration Queue Parameters

For all integration queue import endpoints, you need to specify account, integration and apikey. Please read the Import Queues below for details about these parameters.

https://{BASE_URL}/imports/attributes?account=[ACCOUNT ID]&integration=[INTEGRATION QUEUE ID]&apikey=[INTEGRATION QUEUE API KEY]

Deleting Attributes

Send an HTTP DELETE request to the endpoint with a body containing a JSON array of Attribute ids.

[
  "country", "grape"
]