Items

Definition

Post an item

The Post method will upsert an item in the catalogue. If the item already exists, it'll be updated. Unlike the patch, attributes are fully replaced. The whole item attributes must be sent otherwise only the attributes passed in the body will be stored and used for enrichment. This method checks the presence of mandatory attributes and type matching as defined in the item schema.

If a category tree has been defined for a catalogue version, the categories attribute becomes mandatory

Patch an item

Patch an item is used to update only some attributes of the item. Unlike the upsert, attributes aren't fully replaced but only the updated one. This method is mainly used to change frequently updated attributes e.g: quantity. This method checks only type matching.

Delete an item

Delete an item is used to remove an item from the catalogue. No schema validation is performed for this method.

Variants

If the item is a variant, it's always related to a parent. Parent's attributes will be automatically used for tag computation. Insert or patch the variant with theses attributes, do not include parent's attributes.

Structure

Json item

To create or modify items, these elements must be sent in JSON as an array. Each element must respect the following basic structure.

Attributes

The attributes field is a key-value object of every attribute. These customizable fields are defined in the item schema api. Each attribute must follow the different types defined in your item schema.

Let's say your item schema has the following attributes:

[
    {
        "name": "title"
        "type": "TEXT"
    },
    {
        "name": "price"
        "type": "INTEGER"
    },
]

An item attributes should look like this.

{
    "title": "My Product",
    "price": 1000
}

Json Item id

To delete items, as well as in the creation API return, the format used is a Json called jsonItemId described below.

FHR data model validation

The query parameter fhrValidation=true can be added to enforces Fredhopper specific validation to the items API. This includes the following additional checks to the schema:

  • For int attributes: Greater or equal to zero

  • For float attribute: Greater or equal to zero

  • For object/objectlists:

    • value_ids are lowercased with only [a-z0-9_]+

Last updated