Search commerce products
Use the externalItems GraphQL query search for and retrieve Magento Commerce product data based on matching search text.
Example request
The first sample code block illustrates a request to retrieve the first ten products that include a specified text string.
{ externalItems(namespace:
"magento",
filter: {
context:
{ id: "Mg%3d%3d_Y2F0ZWdvcnk%3d" type: "MagentoCategory" }
searchText: "Hoodie"
}, first: 10, after: "Ng==")
{ edges {
cursor node {
identity { id type } ...
on ExternalContent { title } }
}
}
}
Example response
The second code block illustrates the corresponding response with the matching products along with the requested product details (some data removed in example for space considerations).
{
"data": {
"externalItems": {
"edges": [
{
"cursor": "Nw==",
"node": {
"identity": {
"id": "TUgwMS1YUy1CbGFjaw%3d%3d_Y29udGVudA%3d%3d",
"type": "MagentoProduct"
},
"title": "Chaz Kangeroo Hoodie-XS-Black"
}
},
{
"cursor": "OA==",
"node": {
"identity": {
"id": "TUgwMS1YUy1HcmF5_Y29udGVudA%3d%3d",
"type": "MagentoProduct"
},
"title": "Chaz Kangeroo Hoodie-XS-Gray"
}
},
.
.
.
{
"cursor": "MTU=",
"node": {
"identity": {
"id": "TUgwMS1NLU9yYW5nZQ%3d%3d_Y29udGVudA%3d%3d",
"type": "MagentoProduct"
},
"title": "Chaz Kangeroo Hoodie-M-Orange"
}
},
{
"cursor": "MTY=",
"node": {
"identity": {
"id": "TUgwMS1MLUJsYWNr_Y29udGVudA%3d%3d",
"type": "MagentoProduct"
},
"title": "Chaz Kangeroo Hoodie-L-Black"
}
}
]
}
}
}