-
Notifications
You must be signed in to change notification settings - Fork 20
Graphql examples
Vinicius Zucatti edited this page May 3, 2023
·
1 revision
Here are some examples of how to integrate with the GraphQL server. Add the correct tokens before making those requests
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
body
mutation {
signInUser(input: { email: "[email protected]", password: "test123" }){
token,
user{
email
}
}
}
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
body
mutation {
createUser(input: {email: "[email protected]", password: "test123"}) {
user {
id
}
}
}
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
Bearer Token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJleHAiOjE2NzYwNzk2OTJ9.3fKl0k5vdx839m7qqNK81QB2Q_vV2puup9y3UxbfUW0
body
mutation CreateProduct {
createProduct(
input: {
priceInDiamonds: 10
name: "torta"
shortDescription: "pequeno",
description: "300 ml",
image:"http://myimage.jpg"
}
) {
createdAt
name
priceInDiamonds
userId
}
}
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
Bearer Token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJleHAiOjE2NzYwNzk2OTJ9.3fKl0k5vdx839m7qqNK81QB2Q_vV2puup9y3UxbfUW0
body
mutation DeleteProduct {
deleteProduct(input:{
id: 11,
}){
name
}
}
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
Bearer Token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJleHAiOjE2NzYwNzk2OTJ9.3fKl0k5vdx839m7qqNK81QB2Q_vV2puup9y3UxbfUW0
body
mutation {
updateProduct(input:{
name: "Café com leite",
id:13,
}) {
name,
id
}
}
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
Bearer Token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJleHAiOjE2NzYwNzk2OTJ9.3fKl0k5vdx839m7qqNK81QB2Q_vV2puup9y3UxbfUW0
body
{
allProducts{
id,
name,
userId,
priceInDiamonds,
shortDescription,
description,
createdAt
}
}
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
Bearer Token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJleHAiOjE2NzYwNzk2OTJ9.3fKl0k5vdx839m7qqNK81QB2Q_vV2puup9y3UxbfUW0
body
{
allCustomers {
email,
cpf,
id,
uid
}
}
headers
Content-Type: application/json
X-CSRF-Token: 6qxhPNFVm4n08BfIqemoAhN4_rA7FS-ED5PgAbQiqGvODkKP7CKL1z66XrJ3k-dJBgGNzABdU-hFBaD4bgmjZA
Bearer Token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJleHAiOjE2NzYwNzk2OTJ9.3fKl0k5vdx839m7qqNK81QB2Q_vV2puup9y3UxbfUW0
body
{
allTransactions {
id,
priceInCents,
priceInDiamonds,
transactionType,
userId
}
}