younifyd
Menu

Attach Custom Relationships

Attach Custom Relationships to a Product

POST/pcm/products/{productID}/custom-relationships

Use it in a workflow

  1. Add a step and choose the Elastic Path connector.
  2. Pick the Attach Custom Relationships action (under PIM).
  3. Fill in the fields below, then reference the result from later steps as {{attachCustomRelationships.response.data}}.

Request

Path parameters

productIDstringrequired

A unique identifier for the product.

Request body

Enter the body as JSON in the step's Body field.

dataarray<object>required
slugstringrequired

The slug of the custom relationship.

typestringrequired

This represents the type of resource. Always `custom-relationship`.

One ofcustom-relationship

json
{
  "data": [
    {
      "slug": "string",
      "type": "custom-relationship"
    }
  ]
}

Response

Returns 201 with an object. Read it in later steps with {{attachCustomRelationships.response.data.<field>}}.

dataarray<object>
idstringrequired

A unique identifier generated when a custom relationship is created.

typestringrequired

This represents the type of resource object being returned. Always `custom-relationship`.

One ofcustom-relationship

attributesobjectrequired7 fields
metaobjectrequired2 fields
linksobject

Links are used to allow you to move between requests.

firststring

Always the first page.

laststring

This is `null` if there is only one page.

nextstring

This is `null` if there is only one page.

prevstring

This is `null` if you on the first page.

metaobject
resultsobject1 fields

Contains the results for the entire collection.

json
{
  "data": [
    {
      "id": "string",
      "type": "custom-relationship",
      "attributes": {
        "name": "Related Products",
        "slug": "CRP_related_products",
        "description": "A list of related products shown on the PDP.",
        "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
      },
      "meta": {
        "owner": "store",
        "timestamps": {
          "created_at": "2024-01-10T20:16:35.343Z",
          "updated_at": "2024-01-10T20:16:35.343Z"
        }
      }
    }
  ],
  "meta": {
    "results": {
      "total": 30
    }
  },
  "links": {
    "first": "/pcm/custom_relationships?page[offset]=0&page[limit]=10",
    "last": "/pcm/custom_relationships?page[offset]=20&page[limit]=10",
    "next": "/pcm/custom_relationships?page[offset]=10&page[limit]=10",
    "prev": "/pcm/custom_relationships?page[offset]=8&page[limit]=10"
  }
}

Need more? See the Elastic Path guide for connection setup and behaviour shared by every action.

Was this page helpful?