Cria uma avaliação para um produto. Requer autenticação do cliente.
CreateReviewMutationInput!
| Campo | Tipo | Descrição |
|---|---|---|
| hostname | String! | Hostname da loja. |
| productId | ID! | ID global Relay do produto. |
| stars | Int! | Nota de 1 a 5 estrelas. |
| text | String! | Texto da avaliação. |
| Campo | Tipo | Descrição |
|---|---|---|
| review | Review | Avaliação criada. |
mutation AddReview($input: CreateReviewMutationInput!) {
createReview(input: $input) {
review {
id
stars
text
createdAt
}
}
} {
"input": {
"hostname": "minha-loja",
"productId": "UHJvZHVjdDphYmMx",
"stars": 5,
"text": "Produto excelente! Entrega rápida."
}
} {
"data": {
"createReview": {
"review": {
"id": "review1",
"stars": 5,
"text": "Produto excelente! Entrega rápida.",
"createdAt": "2026-06-10T15:00:00Z"
}
}
}
} const response = await fetch('/graphql', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query: `mutation($input: CreateReviewInput!) {
createReview(input: $input) { success }
}`,
variables: { input: { hostname: "minha-loja", productId: "UHJvZHVjdDphYmMx", stars: 5, comment: "Excelente produto!" } }
})
}); curl -X POST https://minha-loja.com/graphql \
-H "Content-Type: application/json" \
-b "authJwtClient=YOUR_SESSION_COOKIE" \
-d '{"query":"mutation { createReview(input: { hostname: \"minha-loja\", productId: \"UHJvZHVjdDphYmMx\", stars: 5, comment: \"Excelente!\" }) { success } }"}'