Get all custom relationships
GET/pcm/custom-relationships
Gets all Custom Relationships.
To see a list of custom relationships a product is attached to, see Get all Custom Relationships attached to a Product.
To see a list of products that a product is related to, see Get all Related Products of a Products' attached Custom Relationship.
Filtering
Many Commerce API endpoints support filtering. The general syntax is described in Filtering.
The following attributes and operators are supported.
Operator | Attribute | Description | Example |
---|---|---|---|
eq | owner | Equals. Checks if the values of two operands are equal. If they are, the condition is true. | filter=eq(owner,store) |
Request
Query Parameters
Possible values: <= 10000
The number of records to offset the results by.
Possible values: <= 10000
The number of records per page. The maximum limit is 100.
Many Commerce API endpoints support filtering. The general syntax is described here.
Responses
- 200
- 400
- 500
Returns a list of all custom relationships.
- application/json
- Schema
- Example (from schema)
- list-custom-relationships
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"
}
]
}
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"
}
]
}