Skip to main content

Create a Relationship between a Product with one or more Products

POST 

/pcm/products/:productID/custom-relationships/:customRelationshipSlug

  • You can associate a product with up to 2000 other products.
  • You do not need to attach a custom relationship to products beforehand, this will be done automatically by this endpoint.
  • This is a partial update, so if you make a request to this endpoint multiple times with different products in each request, they will not be overwritten but will be appended to the related products list.

If you want to remove a relationship between products, see Delete a Relationship between a product with one or more products.

Prerequisites

  • A Custom Relationship has been created, see create a Custom Relationship.
  • A Product has been created for the relationship to be based from.
  • One or many Product have been created for the product to relate to.

Request

Path Parameters

    productID stringrequired

    A unique identifier for the product.

    customRelationshipSlug stringrequired

    A custom relationship slug.

Body

    data object[]required
  • Array [
  • id stringrequired

    The ID of the product you want to relate.

    type stringrequired

    Possible values: [product]

    This represents the type of resource being returned. Always product.

    attributes object
    sort_order integernullable

    The order in which the product to product should be displayed in relation to others. A lower value represents a higher priority in the display order. If set to NULL, the sort order will be removed.

  • ]

Responses

Returns information related to associated products.

Schema
    meta object
    associated_products string[]

    A list of product IDs that have been successfully associated with this custom relationship.

    products_not_associated object[]

    A list of products that could not be associated, including the reasons why.

  • Array [
  • ID string

    The ID of the product that could not be associated.

    Details string

    Details about why the product could not be associated.

  • ]
  • owner string

    The owner of the resource.

    timestamps object
    created_at date-time

    The date and time the resource was created.

    updated_at date-time

    The date and time the resource was last updated.

Loading...