Skip to main content

Create a custom relationship

POST 

https://euwest.api.elasticpath.com/pcm/custom-relationships

Custom relationships can either be bi-directional or uni-directional.

  • Uni-Directional: By setting bi_directional to false (or omitted from request) a uni-directional custom relationship will be created. Within a uni-directional relationship, if Product A links to Product B, Product B will not link back to Product A. This is ideal when one product (e.g., a base product) recommends another (e.g., an upsell), but the reverse recommendation is unnecessary.

  • Bi-Directional: By setting bi_directional to true a bi-directional custom relationship will be created. Within a bi-directional relationship, if Product A is linked to Product B, Product B will automatically link back to Product A. This bi-directionality ensures a consistent experience, where products always suggest each other as related items.

For more information on use cases, see Custom Relationships.

Custom Relationship slugs must meet the following criteria:

  • be unique
  • be prefixed with CRP_. Product Experience Manager automatically adds the CRP_ prefix if you do not include it.
  • contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.

Once a custom relationship has been created, you can:

  1. Add the custom relationship to a product. See Attach a custom relationship to a product.
  2. Associate a product to multiple products. See Associate a product with other products under a custom relationship.

Request

Responses

Returns a created custom relationship with the following attributes.

Authorization: http

name: bearerAuthtype: httpscheme: bearer

Request Collapse all
Base URL
https://euwest.api.elasticpath.com
Auth
Body required
{
  "data": {
    "type": "custom-relationship",
    "attributes": {
      "name": "Related Products",
      "description": "A list of related products shown on the PDP.",
      "slug": "CRP_related_products",
      "sort_order": 5,
      "external_name": "Similar items to consider",
      "external_description": "Check out these similar products that may also meet your needs or match your preferences.",
      "bi_directional": false
    }
  }
}
ResponseClear

Click the Send API Request button above and see the response here!

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.