Crownpeak
  • Product Discovery Developer Guide
  • πŸ›’Item catalog management
    • What is the Items API?
    • How to work with Items
      • Item Schema
        • Attributes
        • Nested Item Schemas
        • Using the Item Schema API
        • DefaultLocale API
        • Onboarding on/migrating to Fredhopper
        • List of Reserved Attributes
      • Category Tree
        • Using the Category Tree API
        • Onboarding on XO
      • Item Catalog
        • Using the Catalog API
      • Items
        • Using the streaming Items API
        • Using the batch Items API
    • Step by Step guide
      • Step by step guide for Fredhopper customers
    • Feedback
      • Using the Feedback API
    • Authorization to APIs
    • Troubleshooting API errors
  • 🎯XO Recommendations
    • Introduction
    • Using the Recommendations API
    • Setting up the Chrome extension
    • Micro-segmentation
    • XO Legacy APIs
  • πŸ”ŽXO Search
    • Introduction
    • Getting started
    • API Reference
      • Search API
      • Autocomplete API (Beta)
      • Product Suggest API
    • API Parameters
      • Search
      • Pagination
      • Faceting
      • Sorting
      • Grouping
      • Filtering
      • Disable features
      • Response mask
      • Context
    • Configuration limitation
  • πŸ§ͺA/B testing
    • Fredhopper A/B testing
      • Integration steps for a non-caching solution
      • Integration steps for a caching solution
        • Java SDK Integration
          • Setup
          • Retrieve running A/B tests - Java SDK
          • Filter and request variant - Java SDK
          • Extending the SDK
        • Manual A/B tests integration
          • Retrieve running A/B tests
          • Filter out irrelevant A/B tests
          • Assign variants to user
          • Request variant for page
        • Limitations and Best Practices
  • πŸ“šResources
    • Glossary
    • Best Practices
      • Tracker Best Practices
      • Items API Best Practices
      • Fredhopper Data Configuration Best Practices
      • Fredhopper Query Response Best Practices
      • Fredhopper Merchandising Studio Best Practices
    • Privacy Notice
  • Archived Pages
    • FHR Tracking plan
    • XO Tracking plan
    • The Tracking API and JS Library
      • What to Track
        • Generic Actions
          • View
          • Click
          • Add to Cart
          • Remove from Cart
          • Purchase
        • Custom Actions
      • Initializing the JavaScript Library
      • REST API Technical Documentation
Powered by GitBook
On this page
  • Definition
  • Post an item
  • Patch an item
  • Delete an item
  • Variants
  • Structure
  • Json item
  • Attributes
  • Json Item ID
  • Validation
  • FHR data model validation
  1. Item catalog management
  2. How to work with Items

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.

Field name
Field type
mandatory
description

id

string

yes

unique item id. Can not be empty and can only include alphanumeric characters, colons, underscores and hyphens.

catalogVersion

int32

yes

context

string

no

Context (store id, private sales...). Can only include alphanumeric characters, underscores and hyphens.

type

string

yes

timestamp

string

no

attributes

object

yes

see attributes below

parentId

string

no

Parent item, if item is a variant

tenant

string

yes

environment

string

yes

Attributes

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.

Field name
Field type
mandatory
description

id

string

yes

unique item id

catalogVersion

int32

yes

context

string

no

Context (store id, private sales...)

type

string

yes

tenant

string

yes

Based on query parameter

environment

string

yes

Based on query parameter

Validation

Additional validation will be applied to each item:

  • item Id must match regex "^[\w\-:]+$" i.e. item id must only contain Latin letters (uppercase and lowercase) a-z, A-Z, digits: 0-9, hyphens: -, and colons: :

  • item context must match regex "^[\w\-:]+$" i.e. item context must only contain Latin letters (uppercase and lowercase): a-z, A-Z, digits: 0-9, hyphens: -, and colons: :

  • Parent products must not have a parentId

  • Variant (or secondary) products must have a parentId. This applies if the data model has a hierarchy.

  • attributes must be defined in item schema

  • LocalizedText should contain valid locale

  • If categoryTree is defined, items should have a β€œcategories” attribute categories attribute should only contain values from categoryTree categories must not be empty unless it’s a patch

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:

  • Each item must contain at least one attribute

  • 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_]+ i.e. value_id must only contain lowercase Latin letters: a-z, digits: 0-9, and underscores: _

PreviousUsing the Catalog APINextUsing the streaming Items API

Last updated 3 months ago

see

see

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 .

see

see

πŸ›’
item schema
catalog
itemSchema
catalog
itemSchema