List commerce categories and products
Use the externalItems GraphQL query get a list of Magento Commerce categories and products.
Example request
The first sample code block illustrates a request to retrieve all the products under a specified category.
{ externalItems(namespace:
"magento",
filter: {
context:
{ id: "MTU%3d_Y2F0ZWdvcnk%3d" type: "MagentoCategory" }
}, 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 requested data for each Magento Commerce product.
{
"data": {
"externalItems": {
"edges": [
{
"cursor": "Nw==",
"node": {
"identity": {
"id": "Mzg%3d_Y2F0ZWdvcnk%3d",
"type": "MagentoCategory"
},
"title": "What's New"
}
},
{
"cursor": "MTE=",
"node": {
"identity": {
"id": "Nw%3d%3d_Y2F0ZWdvcnk%3d",
"type": "MagentoCategory"
},
"title": "Collections"
}
},
{
"cursor": "MTM=",
"node": {
"identity": {
"id": "Mjk%3d_Y2F0ZWdvcnk%3d",
"type": "MagentoCategory"
},
"title": "Promotions"
}
},
{
"cursor": "MTQ=",
"node": {
"identity": {
"id": "Mzc%3d_Y2F0ZWdvcnk%3d",
"type": "MagentoCategory"
},
"title": "Sale"
}
},
{
"cursor": "MTY=",
"node": {
"identity": {
"id": "NDI%3d_Y2F0ZWdvcnk%3d",
"type": "MagentoCategory"
},
"title": "Office Supplies"
}
}
]
}
}
}