Skip to main content

Prerequisites

In order to upload products, you must already have created your category taxonomy. For information on creating categories in the Product Agent UI, see Creating Categories.

Step 1: Postman Environment Setup

This part of the guide walks you through setting up a Postman environment to interact with the Product Agent API.

Create a new environment

  1. Open Postman.
  2. Click Environments in the sidebar.
  3. Click + to create a new environment. Provide a name such as Product Agent - Prod.

Add the environment variables

Add the following variables to your environment.
access_token and the various defined IDs will be empty initially — they will be populated after making API calls.

Step 2: Authentication

This part of the guide walks you through authenticating with the Product Agent API and storing your access token in Postman for future requests.

Create and set the access token

To authenticate, send a POST request to the token endpoint using your clientId and clientSecret. If you do not have these credentials, contact fabric support.
Tokens expire every 60 minutes.
To automatically save the access_token for future requests:
  1. Go to the Scripts tab in your Postman request.
  2. Select Post-response.
  3. Add the following script: pm.environment.set("access_token", pm.response.json().access_token);
With this script, the access_token environment variable is automatically updated each time a request to the endpoint is made.

Step 3 (Optional): Import Attribute Definitions

You can optionally import attribute definitions for enrichment and mapping workflows. For information on creating attributes in the Product Agent UI, see Creating Attributes. This endpoint accepts a CSV file and creates an import job you can monitor using the returned import_id. We will save this to our environment as attributeWorkflowId.

Expected CSV columns for each attribute definition

Request

To automatically save the attributeWorkflowId for future requests:
  1. Go to the Scripts tab in your Postman request.
  2. Select Post-response.
  3. Add the following script: pm.environment.set("attributeWorkflowId", pm.response.json().import_id);

Check the import status

After the upload succeeds, use the saved attributeWorkflowId to check workflow status with:
In this example, an error was flagged in the upload. You can resolve and publish updates to just that row or re-upload the entire file. Rows with errors are skipped. Once completed, you can review the attribute definitions you uploaded in the UI.
  1. Log in to Product Agent.
  2. In the left nav, click Settings. The Settings menu is displayed.
  3. Click Taxonomy. The Categories tab is displayed by default.
  4. Click Attributes.
Here you can review your attribute definitions.

Step 4: Import Your Products

After the categories and attribute definitions have been imported, products can be uploaded. The product import flow consists of three sequential API calls:
  1. Artifact Upload. Submit the CSV to the artifacts endpoint and store the returned artifact_id.
  2. Optimize Workflow. Create a workflow that processes the artifact and store the returned workflow id.
  3. Get Workflow Status. Poll the workflow until it reaches a review gate or a terminal status.

Expected CSV columns

The catalog file must be UTF-8 encoded, comma-delimited, and include a header row. The following table lists the supported columns.

Artifact Upload

Submit the CSV to the artifacts endpoint. The response includes an artifact_id that is stored as artifactId and referenced when creating the workflow.
To automatically save the artifactId for future requests:
  1. Go to the Scripts tab in your Postman request.
  2. Select Post-response.
  3. Add the following script: pm.environment.set("artifactId", pm.response.json().artifact_id);
For full request and response details, see Upload artifact.

Optimize Workflow

Create an optimization workflow that processes the uploaded artifact. Store the returned workflow id as workflowId.
To automatically save the workflowId for future requests:
  1. Go to the Scripts tab in your Postman request.
  2. Select Post-response.
  3. Add the following script: pm.environment.set("workflowId", pm.response.json().id);
For full request and response details, see Create workflow.

Get Workflow Status

Poll the workflow until status reports COMPLETED. A status of REVIEW_PENDING indicates that the workflow is paused at a human-in-the-loop gate; the current_hitl_gate field identifies the active gate.
Review gates are approved in the CommerceOS web application, not through the API. When polling returns status: REVIEW_PENDING, direct the assigned reviewer to CommerceOS to evaluate and approve the gate. Once the reviewer acts in the UI, the workflow resumes automatically and subsequent polls reflect the new state.
The status value progresses through PENDING, then RUNNING or IN_PROGRESS, then REVIEW_PENDING when paused at a human-in-the-loop gate, and ultimately COMPLETED. FAILED and CANCELLED are terminal alternatives. For the complete status and gate vocabulary, see Get workflow status. Once the workflow reaches COMPLETED, the products appear in Activate organized by category structure. For example, sweaters appear under Tops > Sweaters and t-shirts under Tops > T-Shirts.