The following workflow diagram illustrates the step-by-step interaction process with the Product Catalog API:

The following steps outline the process:

  1. Create attributes that can be assigned to categories and associated products.
  2. Map fabric-mandatory attributes with merchant-defined attributes.
  3. Create categories as the primary organizational structure.
  4. Assign attributes to categories.
  5. Create collections to display products on storefronts and support storefront-specific use cases, including promotions.
  6. Add products, such as individual items, variants, and bundles of items and variants.

Prerequisites

You must have the following:

  • Access and Permissions Setup
    • Ensure that you have Admin or Editor role to set up Product Catalog. For more information about the roles and permissions offered through fabric Identity service, see the Role-based Access Control (RBAC) section.
      • Click here to understand the roles and permissions supported through Role-based Access Control (RBAC) offered through fabric Identity service.
    • Use the V3 version of the Product Catalog API.
  • Authentication and Security Protocols

Procedure

Use this procedure to configure Product Catalog. The API collections for the endpoints are:

  1. Create attributes using one of the following methods:
    • Individually: Create a new attribute using the Create attribute endpoint. By specifying the target in the request body as a product or category, you can assign the attribute to a product or a category, respectively.
    • Bulk Import: Import multiple attributes through bulk import APIs. For more information, see the bulk import guide.
    • (Optional) Create attribute groups using the Create attribute groups endpoint and group relevant attributes. The attribute groups can then be assigned to products.
  2. Map the mandatory fabric attributes, such as sku, title, image, and active status, to the corresponding attribute names provided by the merchant. To create new mapping or update an existing mapping, use the Update attribute endpoint.
  3. Create categories using one of the following methods:
    • Individually: Create a new category using the Create category endpoint. A root category is created by default and can’t be modified.
    • Import Multiple Categories: Add multiple new categories using the Create multiple categories endpoint. You can add up to 25 categories.
    • Bulk Import: Add multiple categories (more than 25) through bulk import APIs. For additional information, refer to the bulk import guide. You can add other category IDs to categoryIdsIncluded which automatically includes a categories catalog of items. Similarly, you can exclude categories using categoryIdsExcluded.
  4. Assign attributes to categories using the Create category and Partially update category endpoint. The attributes of a category automatically cascade to all products associated with that category.
  5. (Optional) Create collections to display products on storefront using the Create collections endpoint.
  6. Add products, which may be items, variants, and bundles, using one of the following methods:
    • Add Item: Add items using the following methods:

      • Individually: Add a single item using the Add product endpoint and specify the type as item.
      • Add Multiple items: Add multiple items using the Add products endpoint and specify the type as item. You can add up to 25 items in a single request.
      • Bulk Import: Import multiple products through bulk import APIs. For additional information, refer to bulk import guide.
    • Add Variants: For creating variants for a product, you must set the product’s status flag to LIVE. If a product status is DRAFT, variants are treated as separate products. Add variants using the following methods:

      • Individually: Add a single variant using the Add product endpoint and specify the type as variant.
      • Add Multiple Variants: Add multiple variants using the Add Products endpoint and specify the type as variant. You can add up to 25 variants.
      • Bulk Import: Import variants using the bulk import APIs. For additional information, refer to the bulk import guide.
        Note: To add a variant, its parentProduct must be in published or draft status. Initially, the type remains as item until the parent is published. Once the parent is published, the type is updated to variant. Additionally, both the parent and its children should belong to the same category and channel.
    • Add Bundles: Add bundles using the following methods:

      • Individually: Add a single bundle using the Add Product endpoint and specify the type as bundle.
      • Add Multiple Products: Add multiple bundles using the Add Products endpoint and specify the type as bundle. You can add up to 25 bundles.
      • Bulk Import: Import bundles using the bulk import guide API. When bulk importing attributes, specify their corresponding type and subtype in the template. The following list shows the Attribute types and their corresponding Attribute sub types:
        • Serial: None
        • Date-Time: None
        • Boolean: None
        • Number: None
        • Text: Small text
        • Text: Text area
        • Text: HTML
        • Options: Single
        • Options: Multiple

      Note: When creating a bundle, make sure to specify the bundleProducts. Ensure the individual items or their variants, which you intend to include in the bundle, already exist in the system.

Import Product Data Through Bulk Import

The following diagram illustrates the step-by-step process to bulk import attributes, categories, collections, items, variants, and bundles:

Take the following steps to bulk import:

  1. Download the template based on the type, which could be items, variants, bundles, attributes, categories, or collections. A CSV template with header columns is returned in the response. You can add required data in the template and save the file in your local system.
    The following code sample provides an example for the template:

Bash

curl --request POST \
     --url https://api.fabric.inc/v3/product-templates/actions/generate \
     --header 'accept: text/csv' \
     --header 'content-type: application/json' \
     --data '
{
  "type": "ITEM",
  "categoryId": "648014741adc8a9de14e1a68",
  "locale": "en-US"
}
'

The following code sample provides an example to bulk import attributes:

Bash

curl --request POST \
     --url https://api.fabric.inc/v3/product-templates/actions/generate \
     --header 'accept: text/csv' \
     --header 'content-type: application/json' \
     --data '{"type":"ATTRIBUTE"}'
  1. Retrieve the AWS S3 bucket URL used to upload the import file by using the Create file object and get upload location endpoint.
    The following code sample provides an example to retrieve the upload URL to import a file:

Bash

curl --request POST \
    --url https://api.fabric.inc/v3/product-files \
    --header 'accept: application/json' \
    --header 'content-type: application/json' \
    --data '
{
 "type": "ITEM_VARIANT_EXPORT",
 "name": "bulk_import_123345677788999.csv",
 "locale": "en-US"
}
'
  1. Make a PUT request with the upload URL, returned in the response of the step 2, to upload the updated CSV file from your local system.
  2. Download one or more previously imported or exported files, including error files, use the Get files available for a merchant endpoint.
    The following code sample provides an example:

Bash

curl --request GET \
    --url 'https://api.fabric.inc/v3/product-files?offset=0&limit=10' \
    --header 'accept: application/json'
  1. To view the status of previously imported or exported files, use the Get jobs endpoint.
    The following code sample provides an example to retrieve the import history:

Bash

curl --request GET \
     --url 'https://api.fabric.inc/v3/product-jobs?offset=0&limit=10' \
     --header 'accept: application/json'