products
Overview
Fetch a paginated list of products. You can tailor the returned fields according to your UI needs.
- Type: GraphQL Query
- Endpoint: https://subdomain.com
- Authentication:
Authorization: Bearer <TOKEN>
Query
query FindAllProducts($input: GetAllProductsInput) {
findAllProducts(input: $input) {
success
message
data {
_id
title
slug
description
app
tags
status
publishedAt
images {
_id
fileUrl
}
collections {
_id
app
title
slug
description
operation
image {
_id
fileUrl
}
}
seo {
title
description
keywords
image
canonicalUrl
}
pricing {
compareAtPrice
originalPrice
price
}
variantsCount
dimensions {
height
width
unit
}
weight {
weight
unit
}
variants {
_id
product
options {
_id
option { name }
label
type
sortOrder
createdAt
updatedAt
}
images { _id fileUrl }
pricing { originalPrice price compareAtPrice }
quantity
weight { unit weight }
}
options {
_id
product
valuesCount
values {
_id
label
type
sortOrder
createdAt
updatedAt
}
name
createdAt
updatedAt
}
}
pagination {
total
page
limit
totalPages
}
}
}
Variables
{
"input": {
"page": 1,
"limit": 20
// Add optional filters/sorting if your API supports them
}
}
Examples
- cURL
- JavaScript (fetch)
curl -X POST \
https://subdomain.com \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "query FindAllProducts($input: GetAllProductsInput) { findAllProducts(input: $input) { success message data { _id title slug } pagination { total page limit totalPages } } }",
"variables": { "input": { "page": 1, "limit": 20 } }
}
EOF
const res = await fetch('https://subdomain.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + token,
},
body: JSON.stringify({
query: `
query FindAllProducts($input: GetAllProductsInput) {
findAllProducts(input: $input) {
success
message
data { _id title slug }
pagination { total page limit totalPages }
}
}
`,
variables: { input: { page: 1, limit: 20 } },
}),
});
const json = await res.json();
Notes
- Replace
<TOKEN>with a valid token. - Add/remove fields within
dataandpaginationaccording to what you render. - If
GetAllProductsInputsupports filters (e.g., text, collection, tags, status), pass them insideinput.