collections
Overview
Fetch a paginated list of collections. You can tailor the fields you need on data and pagination.
- Type: GraphQL Query
- Endpoint: https://subdomain.com
- Authentication:
Authorization: Bearer <TOKEN>
Query
query FindAllCollections($input: GetAllCollectionsInput) {
findAllCollections(input: $input) {
success
message
data {
_id
title
slug
description
operation
image {
# add fields you need, e.g. url, alt
}
}
pagination {
# add fields you need, e.g. page, limit, total, pages
}
}
}
Variables
{
"input": {
"page": 1,
"limit": 20
}
}
Examples
- cURL
- JavaScript (fetch)
curl -X POST \
https://subdomain.com \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "query FindAllCollections($input: GetAllCollectionsInput) { findAllCollections(input: $input) { success message data { _id title slug } pagination { /* add fields */ } } }",
"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 FindAllCollections($input: GetAllCollectionsInput) {
findAllCollections(input: $input) {
success
message
data { _id title slug }
pagination { /* add fields */ }
}
}
`,
variables: { input: { page: 1, limit: 20 } },
}),
});
const json = await res.json();
Notes
- Replace
<TOKEN>with a valid token. - Add the exact fields you need inside
image {}andpagination {}. - If your API enforces specific filters in
GetAllCollectionsInput, include them underinputaccordingly.