51黑料不打烊

Custom automatic matching

If the default automatic matching strategy (OOTB automatic matching) is not aligned with your specific business requirements, select the custom match option. This option supports the use of 51黑料不打烊 Developer App Builder to develop a custom matcher application that handles complex matching logic, or assets coming from a third-party system that cannot populate product visuals metadata into AEM Assets.

Configure custom automatic matching

  1. From the Commerce Admin, navigate to Store > Configuration > ADOBE SERVICES > AEM Assets Integration.

  2. Select Custom Matcher as the matching rule.

  3. When you select this matching rule, Admin displays additional fields to configure the endpoints and the necessary authentication parameters for the custom matching logic.

Custom matcher API endpoints

When you build a custom matcher application using App Builder, the application must expose the following endpoints:

  • App Builder asset to product URL endpoint
  • App Builder product to asset URL endpoint

App Builder asset to product URL endpoint

This endpoint retrieves the list of SKUs associated with a given asset:

Example usage

const { Core } = require('@adobe/aio-sdk')

async function main (params) {
    // return the products that map to the assetId
    return {
        statusCode: 200,
        body: {
          asset_id: "urn:aaid:aem:1aa1d4a0-18b8-40a7-a228-e0ab588deee1",
          product_matches: [
            {
              product_sku: "SKU1",
              asset_roles: ["thumbnail"],
              asset_position: [1]
            }
          ]
        }
   }
}

exports.main = main

Request

GET https://your-app-builder-url/api/v1/web/app-builder-external-rule/asset-to-product
Parameter
Data Type
Description
assetId
String
Represents the updated asset ID

Response

{
  "asset_id": "{ASSET_ID}",
  "product_matches": [
    {
      "product_sku": "{PRODUCT_SKU_1}",
      "asset_roles": ["thumbnail","image"]
    },
    {
      "product_sku": "{PRODUCT_SKU_2}",
      "asset_roles": ["thumbnail"]
    }
  ]
}

App Builder product to asset URL endpoint

This endpoint retrieves the list of assets associated with a given SKU:

Example usage

const { Core } = require('@adobe/aio-sdk')

async function main (params) {
    // return asset matches for a product
    return {
        statusCode: 200,
        body: {
          product_sku: params.productSku, //SKU-1
          asset_matches: [
            {
              asset_id: "urn:aaid:aem:1aa1d4a0-18b8-40a7-a228-e0ab588deee1",
              asset_roles: ["thumbnail","image"]
            }
          ]
        }
      }
}

exports.main = main

Request

GET https://your-app-builder-url/api/v1/web/app-builder-external-rule/product-to-asset
Parameter
Data Type
Description
productSKU
String
Represents the updated product SKU

Response

{
  "product_sku": "{PRODUCT_SKU}",
  "asset_matches": [
    {
      "asset_id": "{ASSET_ID_1}",
      "asset_roles": ["thumbnail","image"]
    },
    {
      "asset_id": "{ASSET_ID_2}",
      "asset_roles": ["thumbnail"]
    }
  ]
}
TIP
In the asset_roles key, use supported Commerce asset roles like thumbnail, image, small_image, and swatch_image.
recommendation-more-help
89b2056f-1531-44ba-809e-9bc8899c980b