globalSearch
Requires permission products:product:read.
Searches the console's records, for staff users only. Needs products:product:read. Result types you cannot read are dropped, and customers or documents outside your scope never appear, even as names.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query GlobalSearch($limit: Int!, $query: String!) {
globalSearch(limit: $limit, query: $query) {
brands {
id
name
description
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query GlobalSearch($limit: Int!, $query: String!) {\n globalSearch(limit: $limit, query: $query) {\n brands {\n id\n name\n description\n }\n }\n}",
"variables": {
"limit": 0,
"query": "string"
}
}
EOF
Variables:
{
"limit": 0,
"query": "string"
}
Response:
{
"data": {
"globalSearch": {
"brands": [
{
"id": "id",
"name": "string",
"description": "string"
}
]
}
}
}
globalSearch(
limit: Int! = 10
query: String!
types: [GlobalSearchType!]
): GlobalSearchResult!
Arguments
globalSearch.limit ● Int! non-null scalar
The maximum number of results. Defaults to 10.
globalSearch.query ● String! non-null scalar
The text to search for.
globalSearch.types ● [GlobalSearchType!] list enum
Only search these result types. Leave out to search every type you may read.
Type
GlobalSearchResult object
The results of a search across the whole application, grouped by kind.