collectionByHandle
Overview
Fetch a single collection by its unique handle.
- Type: GraphQL Query
- Endpoint: https://subdomain.com
- Authentication:
Authorization: Bearer <TOKEN>
Query
query FindCollectionByHandle($handle: String!) {
findCollectionByHandle(handle: $handle) {
success
message
data {
_id
title
slug
description
operation
image {
_id
fileUrl
}
}
}
}
Variables
{
"handle": "<COLLECTION_HANDLE>"
}
Examples
- cURL
- JavaScript (fetch)
curl -X POST \
https://subdomain.com \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "query FindCollectionByHandle($handle: String!) { findCollectionByHandle(handle: $handle) { success message data { _id title slug } } }",
"variables": { "handle": "<COLLECTION_HANDLE>" }
}
EOF
const res = await fetch('https://subdomain.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + token,
},
body: JSON.stringify({
query: `
query FindCollectionByHandle($handle: String!) {
findCollectionByHandle(handle: $handle) {
success
message
data { _id title slug }
}
}
`,
variables: { handle: '<COLLECTION_HANDLE>' },
}),
});
const json = await res.json();
Notes
- Replace
<TOKEN>and<COLLECTION_HANDLE>with valid values. - Add/remove fields inside
dataas required by your UI.