Uploading a product catalog

To use product recommendation on your channel, you need to share your product catalog in the form of a comma-separated (CSV) file.

Prerequisites

  • The organization and channel for which you want to upload the product catalog must be registered in Acoustic Personalization. In other words, you must have the org ID (for the organization) and the channel tenant ID (for the channel) as registered in Acoustic Personalization.
  • Knowledge of REST API tools, such as Postman.

Creating an instance for an organization

  1. Using a REST API tool (for example, Postman), open this URL:

    https://api.ibm.com/realtimepers/run/service/feed/create-instance/<<OrgID>>

    In the URL: Replace <<OrgID>> with your org ID. For example, If your channel tenant ID is cw-507581967-FTTVdDgB, then the org ID will be 507581967 and the URL will be:

    https://api.ibm.com/realtimepers/run/service/feed/create-instance/507581967

  2. Go to the Headers tab.
  3. Add these headers:
    Accept
    Value must be: application/json
    Content-Type
    Value must be: application/json
    x-ibm-client-id
    Provide the appropriate value.
    x-ibm-client-secret
    Provide the appropriate value.
    Note: The values for x-ibm-client-id and x-ibm-client-secret are communicated separately to each customer. For these values, contact your Acoustic Personalization customer representative.
  4. Go to the Body tab.
  5. Click raw option. Do not enter any data under this option.
  6. Click Send.
  7. Copy the instance ID from the response body. For example, If your Response is {"id":"pc-123456789-db8YXrc6"}, then the instance ID is pc-123456789-db8YXrc6.
    Note: Ensure that you save the instance ID so you can use it later in the following sections, while you upload a new product catalog or update an existing catalog for your organization.
On successful instance creation, a message code appears "201", which indicates that the instance ID is created, for example: {"id":"pc-502521664-bsAnrwfJ"}

If your org ID is not valid, a message code appears "400" and you may see an error message "Invalid org ID."

Uploading the product catalog

You can upload the product catalog as a CSV file.

Uploading a new product catalog

  1. Create a .csv file with the fields as described in the topic Product catalog data specification.
  2. Add the product catalog data to be uploaded.
  3. Save the CSV file.
  4. Using a REST API tool (for example, Postman), open this URL:

    https://api.ibm.com/realtimepers/run/service/feed/v2/product-feed/<<OrgID>>/<<InstanceID>>/upload

    In the URL:
    • Replace <<OrgID>> with your org ID. For example, If your channel tenant ID is cw-507581967-FTTVdDgB, then the org ID will be 507581967.
    • Replace <<InstanceID>> with the instance ID that you created.
  5. Go to the Headers tab.
  6. Provide the following information.
    Accept
    Value must be: application/json
    x-ibm-client-id
    Provide the appropriate value.
    x-ibm-client-secret
    Provide the appropriate value.
    Note: The values for x-ibm-client-id and x-ibm-client-secret are communicated separately to each customer. For these values, contact your Acoustic Personalization customer representative.
  7. Go to the Body tab.
  8. Click form-data option.
  9. Select the key as file and from the drop-down list, select the File option.
  10. Click Choose Files. Navigate and select your product catalog CSV file.
  11. Click Send.
On successful file upload, a message appears: “File ingested successfully.”
Table 1. List of error codes returned by the product catalog upload API
Status code Description
400 The [test.txt] file upload failed. The file format is not supported.
422 The file name already exists. Specify a different file name and then upload again.

You can retry the file upload after fixing these issues.

Updating an existing product catalog

  1. Create a .csv file with the fields as described in the topic Product catalog data specification.
  2. Update the product catalog data.
    Ensure that you use the same name for your CSV file whenever you update the catalog again for your instance ID. For example: if you upload a catalog with name abc.csv for instance ID A. You want to update the catalog again for instance ID A, you must upload the CSV file with the same file name abc.csv.
    Note: If you upload a CSV file with the different name, the upload fails and following error appears: "The catalog name does not match with the catalog name [testcatalog.csv] that is already uploaded for your instance ID."
  3. Save the CSV file.
    Remember: When you update the product catalog file for your organization, then existing products are updated and new products are added to the existing product catalog.

    For example, You upload a new product catalog [catalog1.csv] file containing product ids P1, P2, and P3 to Acoustic Personalization. Later, you decide to update the price for P1 and add few more products to the existing catalog. You create another CSV file with the same name [catalog1.csv] containing the records for the product ids P1, P5, and P6. After you upload the file, product P1 gets updated, products P5, P6 are added into Acoustic Personalization, but records for products P2 and P3 exist in Acoustic Personalization and are not deleted.

  4. Using a REST API tool (for example, Postman), open this URL:

    https://api.ibm.com/realtimepers/run/service/feed/v2/product-feed/<<OrgID>>/<<InstanceID>>/upload

    In the URL:
    • Replace <<OrgID>> with your org ID. For example, If your channel tenant ID is cw-507581967-FTTVdDgB, then the org ID is 507581967.
    • Replace <<InstanceID>> with your instance ID.
  5. Go to the Headers tab.
  6. Provide the following information.
    Accept
    Value must be: application/json
    x-ibm-client-id
    Provide the appropriate value.
    x-ibm-client-secret
    Provide the appropriate value.
    Note: The values for x-ibm-client-id and x-ibm-client-secret are communicated separately to each customer. For these values, contact your Acoustic Personalization customer representative.
  7. Go to the Body tab.
  8. Click form-data option.
  9. Select the key as file and from the drop-down list, select the File option.
  10. Click Choose Files. Navigate and select your product catalog CSV file.
  11. Click Send.

On successful file upload, a message appears: “File ingested successfully.”

Table 2. List of error codes returned by the product catalog update API
Status code Description
400 The [test.txt] file upload failed. The file format is not supported.
422 The file name already exists. Specify a different file name and then upload again.
406 The catalog name does not match with catalog name [testcatalog] that is already uploaded for your instance ID.

You can retry the file upload after fixing these issues.