Anchor to productSavedSearchesproduct
productSavedSearches
query
Requires access scope.
Returns a list of the shop's product saved searches.
Anchor to Arguments
•SavedSearchConnection!SavedSearchConnection arguments
- Anchor to afterafter•
The elements that come after the specified cursor.
- Anchor to beforebefore•
The elements that come before the specified cursor.
- Anchor to firstfirst•
The first
n
elements from the paginated list.- Anchor to lastlast•
The last
n
elements from the paginated list.- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Was this section helpful?
Anchor to Possible returnsPossible returns
- Anchor to edgesedges•[Saved
Search non-nullEdge!]! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
- Anchor to nodesnodes•[Saved
Search!]! non-null A list of nodes that are contained in SavedSearchEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
- Anchor to pageInfopage•
Info PageInfo! non-null An object that’s used to retrieve cursor information about the current page.
Was this section helpful?
Retrieve the first three saved product searches
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query {6 productSavedSearches(first: 3) {7 nodes {8 id9 legacyResourceId10 name11 filters {12 key13 value14 }15 query16 searchTerms17 }18 }19 }`,20);2122const data = await response.json();23
query {
productSavedSearches(first: 3) {
nodes {
id
legacyResourceId
name
filters {
key
value
}
query
searchTerms
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { productSavedSearches(first: 3) { nodes { id legacyResourceId name filters { key value } query searchTerms } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
productSavedSearches(first: 3) {
nodes {
id
legacyResourceId
name
filters {
key
value
}
query
searchTerms
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
productSavedSearches(first: 3) {
nodes {
id
legacyResourceId
name
filters {
key
value
}
query
searchTerms
}
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
productSavedSearches(first: 3) {
nodes {
id
legacyResourceId
name
filters {
key
value
}
query
searchTerms
}
}
}
QUERY
response = client.query(query: query)
Response
JSON1{2 "productSavedSearches": {3 "nodes": [4 {5 "id": "gid://shopify/SavedSearch/136409974",6 "legacyResourceId": "136409974",7 "name": "Foo Products",8 "filters": [],9 "query": "foo",10 "searchTerms": "foo"11 },12 {13 "id": "gid://shopify/SavedSearch/1068136127",14 "legacyResourceId": "1068136127",15 "name": "Drafts",16 "filters": [17 {18 "key": "status",19 "value": "DRAFT"20 }21 ],22 "query": "status:\"DRAFT\"",23 "searchTerms": ""24 },25 {26 "id": "gid://shopify/SavedSearch/1068136128",27 "legacyResourceId": "1068136128",28 "name": "Products from Vendor X",29 "filters": [30 {31 "key": "vendor",32 "value": "Vendor X"33 }34 ],35 "query": "vendor:\"Vendor X\"",36 "searchTerms": ""37 }38 ]39 }40}