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
  • Example
  • Create the item schema
  • Create the catalog
  • Sending the items
  • Patch method
  1. Item catalog management

Step by Step guide

Example

Here we'll show an example of a parent item and a variant being sent. Once the items have been sent, we will promote the catalog as active. We then send a patch on the variant.

The sample of items:

Item parent
{
    "id": "A0001",
    "attributes": {
        "title": "My item",
        "description": "This is my item."
    }
}
Item variant
{
    "id": "B0001",
    "attributes": {
        "price": 2000,
        "color": "red"
    },
    "parentId": "A0001"
}

Create the item schema

The first step is to create an item schema. It must contain the attributes of the item and its variant.

POST /item-schemas?tenant=mycompany&environment=production
{
    "name": "product",
    "attributes": [
        {
            "name": "title",
            "type": "TEXT"
        },
        {
            "name": "description",
            "type": "TEXT"
        }
    ],
    "nestedItemSchemas": [
        {
            "name": "variant",
            "attributes": [
                {
                    "name": "price",
                    "type": "INTEGER"
                },
                {
                    "name": "color",
                    "type": "TEXT"
                }
            ]
        }
    ]
}
{
    "version": 1
}

Create the catalog

Remember! Catalog API can handle only 2 catalogs at the same time. If this limit is reached, one inactive catalog must be deleted by using the API before creating a new one. Determining the inactive catalog is done by listing all catalogs API.

POST /catalogs?tenant=mycompany&environment=production
{
    "catalogItemSchemas": [
        {
            "name": "product",
            "version": 1
        }
    ]
}
{
    "version": 1
}

Sending the items

POST /items?tenant=mycompany&environment=production
[
    {
        "id": "A0001",
        "catalogVersion": 1,
        "type": "product",
        "attributes": {
            "title": "My item",
            "description": "This is my item."
        }
    },
    {
        "id": "B0001",
        "catalogVersion": 1,
        "type": "variant",
        "attributes": {
            "price": 2000,
            "color": "red"
        },
        "parentId": "A0001"
    }
]
{
    "requestIds": [
        {
            "itemId": {
                "id": "A0001",
                "catalogVersion": 1,
                "context": "",
                "type": "product",
                "tenant": "mycompany",
                "environment": "production"
            },
            "requestId": "1888742087434729"
        },
        {
            "itemId": {
                "id": "B0001",
                "catalogVersion": 1,
                "context": "",
                "type": "variant",
                "tenant": "mycompany",
                "environment": "production"
            },
            "requestId": "1888742087434730"
        }
    ]
}

Then, promote your catalog version.

POST /catalogs/promote/1?tenant=mycompany&environment=production

After a short period of time, the catalog will be active and usable.

Patch method

To quickly change the attribute of an item, use the patch method.

Here is an example of changing the price of the variant:

PATCH /items?tenant=mycompany&environment=production
[
    {
        "id": "B0001",
        "catalogVersion": 1,
        "type": "variant",
        "attributes": {
            "price": 1500,
        },
        "parentId": "A0001"
    }
]
PreviousUsing the batch Items APINextStep by step guide for Fredhopper customers

Last updated 7 months ago

Next, create a catalog version. As this is the first catalog the version is 1, but you can .

🛒
list your catalogs