Get a commerce product
Use the externalItem GraphQL query get a single Magento Commerce product.
Query syntax
The following code illustrates required format for the GraphQL request, followed by a description of the input values:
{
externalItem([eclUri: "ECL-URI"]
[identity: {
namespace: "NAMESPACE",
id: "IDENTIFIER",
type: "TYPE"
}])
{
... on TYPE {
RESPONSE_FIELD_1
RESPONSE_FIELD_2
RESPONSE_FIELD_n
}
}
}
Fields and inputs
- eclUri
- ECL-URI for the entity being requested.
- identity
- The
identityobject is formed from the following field values to uniquely identify the entity to be retrieved: - ... on TYPE
-
Defines the query response, where:
- TYPE is the entity type and matches the TYPE value in the identity section.
- RESPONSE_FIELD_1 to RESPONSE_FIELD_n are the specific data fields that you want to be returned in the response.
Example request and response
The first sample code block illustrates a request to retrieve a product based on its ECL URI. The second code block illustrates the corresponding response with the requested product details.
| Request | Response |
|---|---|
| |