externalItems query
Use the externalItems GraphQL query to search for and retrieve product data based on matching search text.
Query syntax
The following code illustrates required format for the GraphQL request, followed by a description of the input values:
{
externalItems([namespace: "NAMESPACE"]
filter: {
[context: {
[namespace: "NAMESPACE",]
id: "IDENTIFIER",
type: "TYPE"
[,localeId: "LOCALE_ID"]
},]
[searchText: "SEARCH TEXT",]
[type: "TYPE"]
},
# Pagination
[first: NUM_ITEMS,]
[after: "[cursor]"])
{
edges {
node {
... on TYPE {
RESPONSE_FIELD_1
RESPONSE_FIELD_2
RESPONSE_FIELD_n
}
}
}
}
}
Fields and inputs
- namespace
- Sets the overall query scope, where NAMESPACE is the namespace name for query.
- filter
- Defines the values you want to match in the query results, and can include one or more of the following:
- # Pagination
-
The following two parameters work together for data pagination:
- first
- The value for NUM_ITEMS sets the first number of matching items to retrieve.
- after
- For all requests following the initial one, the value for CURSOR defines the starting point of the query.
- ... 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 the first two products (product is the entity type) that include the specified text string. The second code block illustrates the corresponding response with two matching products along with the requested product details.
| Request | Response |
|---|---|
| |