Attach Custom Relationships to a Product
POST/pcm/products/:productID/custom-relationships
You can attach up to 5 custom relationships to a product.
Once you have attached a custom relationship to a product, you can then create relationships from a product to one or many other products. See Associate a product to one or more products using a custom relationship.
See Custom Relationships.
Prerequisites
- A Custom Relationship has been created, see create a Custom Relationship,
- A Product has been created.
Request
Path Parameters
A unique identifier for the product.
- application/json
Body
- Array [
- ]
data object[]required
The slug of the custom relationship.
Possible values: [custom-relationship
]
This represents the type of resource. Always custom-relationship
.
Responses
- 201
- 400
- 403
- 404
- 409
- 422
- 500
Returns the attached custom relationships
- application/json
- Schema
- Example (from schema)
- custom-relationship
Schema
- Array [
- ]
data object[]required
A unique identifier generated when a custom relationship is created.
Possible values: [custom-relationship
]
This represents the type of resource object being returned. Always custom-relationship
.
attributes objectrequired
The name of the custom relationship to display to shoppers, such as Kitchen electrics
.
A description of the custom relationship.
Possible values: Value must match regular expression ^[A-Za-z0-9._-]+$
A unique slug for the custom relationship. Must match the slug specified in the request path. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.
The order in which the custom relationship 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.
The shopper-facing name for the custom relationship. This value will be displayed to shoppers in the store-front, replacing the internal name if present. If set to NULL, the external name will be removed.
The shopper-facing description for the custom relationship. This value will be shown to shoppers in the store-front, replacing the internal description if present. If set to NULL, the external description will be removed.
Is this relationship one way or bi-directional true
or false
. Default is false
meta objectrequired
The owner of the resource.
timestamps objectrequired
The date and time the resource is created.
The date and time the resource is updated.
links object
Links are used to allow you to move between requests.
Always the first page.
This is null
if there is only one page.
This is null
if there is only one page.
This is null
if you on the first page.
meta objectrequired
results object
Contains the results for the entire collection.
Total number of results for the entire collection.
{
"data": [
{
"id": "string",
"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
},
"meta": {
"owner": "store",
"timestamps": {
"created_at": "2024-01-10T20:16:35.343Z",
"updated_at": "2024-01-10T20:16:35.343Z"
}
}
}
],
"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"
},
"meta": {
"results": {
"total": 30
}
}
}
{
"data": [
{
"id": "f3297ee8-da90-45e9-ae56-a2654aebbdfe",
"type": "custom-relationship",
"attributes": {
"name": "Kitchen electrics",
"description": "Kitchen electric devices",
"slug": "CRP_kitchen_individual_devices",
"bi_directional": false
},
"meta": {
"owner": "store",
"timestamps": {
"created_at": "2024-01-10T20:16:35.343Z",
"updated_at": "2024-01-10T20:16:35.343Z"
}
}
},
{
"id": "21b1315b-c47f-4766-85bf-7bf0f94d73b6",
"type": "custom-relationship",
"attributes": {
"name": "Related Products",
"description": "A list of related products shown on the PDP",
"slug": "CRP_related_products",
"bi_directional": true
},
"meta": {
"owner": "store",
"timestamps": {
"created_at": "2024-01-10T20:16:35.343Z",
"updated_at": "2024-01-10T20:16:35.343Z"
}
}
},
{
"id": "e390ff7e-efc4-4769-90d2-fceabcc1e2cd",
"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
},
"meta": {
"owner": "store",
"timestamps": {
"created_at": "2024-01-10T20:16:35.343Z",
"updated_at": "2024-01-10T20:16:35.343Z"
}
}
}
],
"links": {
"last": "/pcm/custom_relationships?page[offset]=29&page[limit]=1",
"next": "/pcm/custom_relationships?page[offset]=1&page[limit]=1"
},
"meta": {
"results": {
"total": 3
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- bad-request
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Bad Request",
"detail": "Could not parse the supplied filter",
"status": "400"
}
]
}
Forbidden
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Forbidden",
"status": "403",
"detail": "entity owned by organization"
}
]
}
Bad Request. Not Found.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Not Found",
"status": "404"
}
]
}
Write conflict detected
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Conflict",
"status": "409",
"detail": "write conflict detected"
}
]
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- failed-validation
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Failed Validation",
"status": "422",
"detail": "<XYZ> can not be empty"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"status": "500",
"title": "Internal Server Error",
"detail": "There was an internal server error, you can report with your request id.",
"request_id": "635da56d-75a1-43cd-b696-7ab119756b3a"
}
]
}