Facets

The Facets Import Endpoint

https://{BASE_URL}/imports/facets

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 Facets to the endpoint. Existing facets are overwritten based on their id.

JSON Example

[
    {
      "id" : "brand",
      "name" : "Brand",
      "type" : {
        "attribute" : {
          "id" : "brand",
          "type" : {
            "options" : {
              "options" : true
            }
          }
        }
      }
    },
    {
      "id" : "length",
      "name" : "Length",
      "type" : {
        "attribute" : {
          "id" : "length",
          "type" : {
            "number" : {
              "interval_count" : 5,
              "max" : 10,
              "min" : 0
            }
          }
        }
      }
    },
    {
      "id" : "price",
      "name" : "Price",
      "type" : {
        "price" : {
          "interval_count" : 5
        }
      }
    },
    {
      "id" : "tags",
      "name" : {
        "da" : "Mærker",
        "en" : "Tags"
      },
      "type" : {
        "tags" : {
          "tags" : true
        }
      }
    }
]

Models

The facets are described by an array of facet definitions like the example above.

The facet model looks like this

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

L10nString is a localized string.

There are 3 types of facet types:

  • attribute
  • price
  • tags

The simplest one is the tags type. Since it only specifies that the POS app should create a facet shows all tags found in the global tags list as options, we only need to provide a presence for it.

{
    "tags" : {
        "tags" : true
    }
}

Next up is the price type. Here it's possible to specify how many price intervals you'd like to have. The POS app automatically calculates the intervals from the min and max prices in the shop that's logged in to.

{
   "price" : {
        "interval_count" : "<integer i, in the range 2 >= i <= 10>"
   }
}

Finally we have the attribute type

{
    "attribute" : {
        "id" : "<string, required>",
        "type" : "<attribute facet type, required>"
    }
}

In Ka-ching we have 3 different types of product attributes that you can create a facet from

  • options
  • number

The simplest one is options. Since it just specifies that the POS app should create a facet with all the options defined in the product attribute, we just need to provide a presence

{
    "options" : {
        "options" : true
    }
}

For the number attribute facet type it's possible to specify how many interval options you want in the facet, based on a min value and a maxvalue.

{
    "number" : {
       "interval_count" : "<integer i, in the range 2 >= i <= 10>",
       "max" : "<decimal, required>",
       "min" : "<decimal, required>"
    }
}

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/facets?account=[ACCOUNT ID]&integration=[INTEGRATION QUEUE ID]&apikey=[INTEGRATION QUEUE API KEY]

Deleting Facets

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

[
  "length", "tags"
]