Get a Hierarchy's Products
GEThttps://euwest.api.elasticpath.com/catalog/hierarchies/:hierarchy_id/products
Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status.
If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See Resolving catalog rules.
You can see the parent nodes a product is associated with in the bread_crumbs
and bread_crumb_nodes
metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See Product and Node Associations in Breadcrumb Metadata.
Filtering
This endpoint supports filtering. For general filtering syntax, see Filtering. The following operators and attributes are available when filtering on this endpoint.
Operator | Description | Supported Attributes | Example |
---|---|---|---|
Eq | Checks if the values of two operands are equal. If they are, the condition is true. For product_types and tags , you can only specify one. For example, filter=eq(product_types,child) . | name , sku , slug , manufacturer_part_num , upc_ean , product_types , tags | filter=eq(name,some-name) |
In | Checks if the values are included in the specified string. If they are, the condition is true. For product_types and tags , you can specify more than one. For example, filter=in(product_types,child,bundle) . | id , name , sku , slug , manufacturer_part_num , upc_ean , product_types , tags | filter=in(id,some-id) |
Building breadcrumbs in a storefront
In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below.
filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)
- Specify the node Ids in the filter expression.
- You can have as many node Ids as you want.
- It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated.
Including Resources
Using the include
parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug.
Parameter | Required | Description |
---|---|---|
component_products | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
main_image | Optional | The main images associated with a product. |
files | Optional | Any files associated with a product. |
See Including Resources.
Request
Path Parameters
The catalog hierarchy ID.
Query Parameters
This endpoints support filtering. See Filtering.
Possible values: >= 1
The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the page length store setting is used.
Possible values: <= 10000
The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the page length store setting is used.
Header Parameters
The language and locale your storefront prefers. See Accept-Language.
The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the EP-Channel
header in your requests.
Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the EP-Context-Tag
header.
Responses
- 200
- default
The products of a catalog hierarchy.
- application/json
- Schema
- Example (from schema)
Schema
meta object
data object[]
links object
{
"meta": {
"results": {
"total": 0
},
"page": {
"limit": 0,
"offset": 0,
"current": 0,
"total": 0
}
},
"data": [
{
"attributes": {
"published_at": "1970-01-01T00:00:00.000",
"base_product": false,
"base_product_id": "cdf574bc-e36e-48fc-9eac-01c87839b285",
"commodity_type": "physical",
"curated_product": true,
"upc_ean": "0123456",
"manufacturer_part_num": "mfn1",
"tags": [
"tag-a"
],
"price_modifiers": [
"modifier-1"
],
"created_at": "1970-01-01T00:00:00.000",
"description": "This is a product",
"name": "Blue shirt",
"price": {},
"shopper_attributes": {},
"tiers": {},
"components": {},
"custom_inputs": {},
"sku": "blue-shirt",
"slug": "blue-shirt",
"status": "live",
"external_ref": "string",
"updated_at": "1970-01-01T00:00:00.000",
"extensions": {}
},
"id": "8fccaa19-dba9-4621-8d11-31a222a68c7c",
"relationships": {
"parent": {
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "product"
}
},
"children": {
"data": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "product"
}
],
"links": {
"self": "string"
}
},
"files": {
"data": [
{
"type": "file",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "1970-01-01T00:00:00.000"
}
]
},
"main_image": {
"data": {
"type": "main_image",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
},
"component_products": {
"data": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "product"
}
],
"links": {
"self": "string"
}
}
},
"type": "product",
"meta": {
"bread_crumbs": {},
"bread_crumb_nodes": [
"8dbb35b2-ef04-477e-974d-e5f3abe6faae"
],
"catalog_id": "362a16dc-f7c6-4280-83d6-4fcc152af091",
"pricebook_id": "f5466169-0037-460c-b181-b02682b6f4de",
"display_price": {
"with_tax": {
"amount": "47500",
"currency": "USD",
"formatted": "$475.00"
},
"without_tax": {
"amount": "47500",
"currency": "USD",
"formatted": "$475.00"
}
},
"catalog_source": "pim",
"sale_id": "string",
"sale_expires": "1970-01-01T00:00:00.000",
"original_price": {},
"original_display_price": {
"with_tax": {
"amount": "47500",
"currency": "USD",
"formatted": "$475.00"
},
"without_tax": {
"amount": "47500",
"currency": "USD",
"formatted": "$475.00"
}
},
"bundle_configuration": {
"selected_options": {}
},
"component_products": {},
"price_modifiers": {},
"tiers": {},
"variation_matrix": {},
"variations": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"sort_order": 0,
"option": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"sort_order": 0,
"description": "string"
},
"options": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"sort_order": 0,
"description": "string"
}
]
}
],
"child_option_ids": [
[
"8dbb35b2-ef04-477e-974d-e5f3abe6faae",
"6ddf2a66-d805-449c-a0e1-8e81335e31a6"
]
],
"child_variations": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"sort_order": 0,
"option": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"sort_order": 0,
"description": "string"
},
"options": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"sort_order": 0,
"description": "string"
}
]
}
],
"product_types": [
"string"
],
"language": "en-GB"
}
}
],
"links": {
"self": "string",
"first": "string",
"last": "string",
"prev": "string",
"next": "string"
}
}
The unexpected error.
- application/json
- Schema
- Example (from schema)
Schema
errors object[]
{
"errors": [
{
"detail": "not processable",
"status": "422",
"title": "There was a problem processing your request."
}
]
}
Authorization: Authorization
name: Authorizationtype: httpin: headerscheme: bearer
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X GET 'https://euwest.api.elasticpath.com/catalog/hierarchies/:hierarchy_id/products' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'