Instantly share code, notes, and snippets.

Embed
What would you like to do?
GraphQL requests and responses for blog post about using GraphQL with Episerver Commerce. Read about it here: https://stefanolsen.com/posts/using-graphql-with-episerver-commerce/
{
"query":"mutation AddToCartMutation($input: AddToCartInput!) {
addToCart(input: $input) {
cart {
total {
amount
currencyCode
formattedAmount
}
}
}
}
",
"variables":{
"input":{
"code":"SKU-37323420",
"quantity":1
}
},
"operationName":"AddToCartMutation"
}
{
"data": {
"addToCart": {
"cart": {
"total": {
"amount": 17.5,
"currencyCode": "USD",
"formattedAmount": "$17.50"
}
}
}
}
}
{
"query":"mutation ChangeCartItemMutation($input: ChangeCartItemInput!)
{
changeCartItem(input: $input)
{
cart {
total {
amount
currencyCode
formattedAmount
}
}
}
}",
"variables":{
"input":{
"code":"SKU-44477844",
"quantity":2,
"shipmentId":-1,
"size":"14 US / 48.5 UK/EU",
"newSize":"14 US / 48.5 UK/EU",
"displayName":"Puma Guida Moc SF Chase Mens Size 14 Red Leather Loafers Shoes UK EU 48.5"}
},
"operationName":"ChangeCartItemMutation"
}
{
"data": {
"changeCartItem": {
"cart": {
"total": {
"amount": 35,
"currencyCode": "USD",
"formattedAmount": "$35.00"
}
}
}
}
}
{
"query":"{
cart {
total {
amount
currencyCode
formattedAmount
},
totalDiscount {
amount
currencyCode
formattedAmount
},
shipments {
shipmentId
shippingMethodId
cartItems {
brand
code
displayName
url
imageUrl
placedPrice {
formattedAmount
}
discountedPrice {
formattedAmount
}
quantity
}
}
}
}",
"variables":null
}
{
"data": {
"cart": {
"total": {
"amount": 35,
"currencyCode": "USD",
"formattedAmount": "$35.00"
},
"totalDiscount": {
"amount": 0,
"currencyCode": "USD",
"formattedAmount": "$0.00"
},
"shipments": [
{
"shipmentId": -1,
"shippingMethodId": "cb735d3c-72fd-44b1-8c59-5475be48fda7",
"cartItems": [
{
"brand": "Mary Jane",
"code": "SKU-37323420",
"displayName": "Brinley Co. Womens High Heel Platform Mary Janes",
"url": "/en/fashion/womens/womens-shoes/p-37323420/?variationCode=SKU-37323420",
"imageUrl": "/globalassets/catalog/0087019128763_color_nude_sw_500x500",
"placedPrice": {
"formattedAmount": "$17.50"
},
"discountedPrice": {
"formattedAmount": "$35.00"
},
"quantity": 2
}
]
}
]
}
}
}
{
"query":"{
cart {
total {
amount
currencyCode
formattedAmount
},
shipments {
cartItems {
brand
code
displayName
url
imageUrl
placedPrice {
formattedAmount
}
discountedPrice {
formattedAmount
}
quantity
}
}
},
products(query: \"sho\", first:20)
{
totalCount
edges {
node {
code
brand
isAvailable
url
placedPrice {
amount
currencyCode
formattedAmount
}
discountedPrice {
amount
currencyCode
formattedAmount
}
}
cursor
}
pageInfo {
endCursor
hasNextPage
}
}
}"
}
{
"data": {
"cart": {
"total": {
"amount": 35,
"currencyCode": "USD",
"formattedAmount": "$35.00"
},
"shipments": [
{
"cartItems": [
{
"displayName": "Brinley Co. Womens High Heel Platform Mary Janes",
"placedPrice": {
"formattedAmount": "$17.50"
},
"quantity": 2
}
]
}
]
},
"products": {
"totalCount": 45,
"edges": [
{
"node": {
"code": "P-38426422",
"brand": "fruit of the loom",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-38426422/",
"placedPrice": {
"amount": 3.5,
"currencyCode": "USD",
"formattedAmount": "$3.50"
},
"discountedPrice": {
"amount": 3.5,
"currencyCode": "USD",
"formattedAmount": "$3.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjA="
},
{
"node": {
"code": "P-39745548",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-39745548/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE="
},
{
"node": {
"code": "P-39672756",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-39672756/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjI="
},
{
"node": {
"code": "P-40825889",
"brand": "faded glory",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-40825889/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjM="
},
{
"node": {
"code": "P-22153156",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-22153156/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjQ="
},
{
"node": {
"code": "P-42087915",
"brand": "danskin now",
"isAvailable": true,
"url": "/en/fashion/womens/womens-bottoms/p-42087915/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjU="
},
{
"node": {
"code": "P-39101253",
"brand": "tv & movie",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-39101253/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjY="
},
{
"node": {
"code": "P-39672546",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-39672546/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjc="
},
{
"node": {
"code": "P-42122310",
"brand": "no boundaries",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-42122310/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjg="
},
{
"node": {
"code": "P-22471422",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-22471422/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjk="
},
{
"node": {
"code": "P-22154305",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-22154305/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEw"
},
{
"node": {
"code": "P-42067915",
"brand": "danskin now",
"isAvailable": true,
"url": "/en/fashion/womens/womens-bottoms/p-42067915/",
"placedPrice": {
"amount": 6.5,
"currencyCode": "USD",
"formattedAmount": "$6.50"
},
"discountedPrice": {
"amount": 6.5,
"currencyCode": "USD",
"formattedAmount": "$6.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEx"
},
{
"node": {
"code": "P-24797574",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-24797574/",
"placedPrice": {
"amount": 7,
"currencyCode": "USD",
"formattedAmount": "$7.00"
},
"discountedPrice": {
"amount": 7,
"currencyCode": "USD",
"formattedAmount": "$7.00"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEy"
},
{
"node": {
"code": "P-36063043",
"brand": "faded glory",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-36063043/",
"placedPrice": {
"amount": 8,
"currencyCode": "USD",
"formattedAmount": "$8.00"
},
"discountedPrice": {
"amount": 8,
"currencyCode": "USD",
"formattedAmount": "$8.00"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEz"
},
{
"node": {
"code": "P-36127195",
"brand": "faded glory",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shoes/p-36127195/",
"placedPrice": {
"amount": 14.5,
"currencyCode": "USD",
"formattedAmount": "$14.50"
},
"discountedPrice": {
"amount": 9.28,
"currencyCode": "USD",
"formattedAmount": "$9.28"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE0"
},
{
"node": {
"code": "P-39672603",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-bottoms/p-39672603/",
"placedPrice": {
"amount": 10.5,
"currencyCode": "USD",
"formattedAmount": "$10.50"
},
"discountedPrice": {
"amount": 10.5,
"currencyCode": "USD",
"formattedAmount": "$10.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE1"
},
{
"node": {
"code": "P-36276861",
"brand": "generic",
"isAvailable": true,
"url": "/en/fashion/womens/womens-shoes/p-36276861/",
"placedPrice": {
"amount": 11.5,
"currencyCode": "USD",
"formattedAmount": "$11.50"
},
"discountedPrice": {
"amount": 11.5,
"currencyCode": "USD",
"formattedAmount": "$11.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE2"
},
{
"node": {
"code": "P-42518256",
"brand": "puma",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shoes/p-42518256/",
"placedPrice": {
"amount": 18.5,
"currencyCode": "USD",
"formattedAmount": "$18.50"
},
"discountedPrice": {
"amount": 11.84,
"currencyCode": "USD",
"formattedAmount": "$11.84"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE3"
},
{
"node": {
"code": "P-42313640",
"brand": "concepts",
"isAvailable": true,
"url": "/en/fashion/womens/womens-dresses/p-42313640/",
"placedPrice": {
"amount": 13,
"currencyCode": "USD",
"formattedAmount": "$13.00"
},
"discountedPrice": {
"amount": 13,
"currencyCode": "USD",
"formattedAmount": "$13.00"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE4"
},
{
"node": {
"code": "P-42340084",
"brand": "riders by lee",
"isAvailable": true,
"url": "/en/fashion/womens/womens-dresses/p-42340084/",
"placedPrice": {
"amount": 13.5,
"currencyCode": "USD",
"formattedAmount": "$13.50"
},
"discountedPrice": {
"amount": 13.5,
"currencyCode": "USD",
"formattedAmount": "$13.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE5"
}
],
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjE5",
"hasNextPage": true
}
}
}
}
{
"query":"{
products(query: \"sho\", first:20)
{
totalCount
edges {
node {
code
brand
isAvailable
url
placedPrice {
amount
currencyCode
formattedAmount
}
discountedPrice {
amount
currencyCode
formattedAmount
}
}
cursor
}
pageInfo {
endCursor
hasNextPage
}
}
}",
"variables":null
}
{
"data": {
"products": {
"totalCount": 45,
"edges": [
{
"node": {
"code": "P-38426422",
"brand": "fruit of the loom",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-38426422/",
"placedPrice": {
"amount": 3.5,
"currencyCode": "USD",
"formattedAmount": "$3.50"
},
"discountedPrice": {
"amount": 3.5,
"currencyCode": "USD",
"formattedAmount": "$3.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjA="
},
{
"node": {
"code": "P-39745548",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-39745548/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE="
},
{
"node": {
"code": "P-39672756",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-39672756/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjI="
},
{
"node": {
"code": "P-40825889",
"brand": "faded glory",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-40825889/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjM="
},
{
"node": {
"code": "P-22153156",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-22153156/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjQ="
},
{
"node": {
"code": "P-42087915",
"brand": "danskin now",
"isAvailable": true,
"url": "/en/fashion/womens/womens-bottoms/p-42087915/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjU="
},
{
"node": {
"code": "P-39101253",
"brand": "tv & movie",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-39101253/",
"placedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
},
"discountedPrice": {
"amount": 4.5,
"currencyCode": "USD",
"formattedAmount": "$4.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjY="
},
{
"node": {
"code": "P-39672546",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-tees/p-39672546/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjc="
},
{
"node": {
"code": "P-42122310",
"brand": "no boundaries",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-42122310/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjg="
},
{
"node": {
"code": "P-22471422",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-22471422/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjk="
},
{
"node": {
"code": "P-22154305",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-22154305/",
"placedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
},
"discountedPrice": {
"amount": 5.5,
"currencyCode": "USD",
"formattedAmount": "$5.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEw"
},
{
"node": {
"code": "P-42067915",
"brand": "danskin now",
"isAvailable": true,
"url": "/en/fashion/womens/womens-bottoms/p-42067915/",
"placedPrice": {
"amount": 6.5,
"currencyCode": "USD",
"formattedAmount": "$6.50"
},
"discountedPrice": {
"amount": 6.5,
"currencyCode": "USD",
"formattedAmount": "$6.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEx"
},
{
"node": {
"code": "P-24797574",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-24797574/",
"placedPrice": {
"amount": 7,
"currencyCode": "USD",
"formattedAmount": "$7.00"
},
"discountedPrice": {
"amount": 7,
"currencyCode": "USD",
"formattedAmount": "$7.00"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEy"
},
{
"node": {
"code": "P-36063043",
"brand": "faded glory",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shirts/p-36063043/",
"placedPrice": {
"amount": 8,
"currencyCode": "USD",
"formattedAmount": "$8.00"
},
"discountedPrice": {
"amount": 8,
"currencyCode": "USD",
"formattedAmount": "$8.00"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjEz"
},
{
"node": {
"code": "P-36127195",
"brand": "faded glory",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shoes/p-36127195/",
"placedPrice": {
"amount": 14.5,
"currencyCode": "USD",
"formattedAmount": "$14.50"
},
"discountedPrice": {
"amount": 9.28,
"currencyCode": "USD",
"formattedAmount": "$9.28"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE0"
},
{
"node": {
"code": "P-39672603",
"brand": "hanes",
"isAvailable": true,
"url": "/en/fashion/womens/womens-bottoms/p-39672603/",
"placedPrice": {
"amount": 10.5,
"currencyCode": "USD",
"formattedAmount": "$10.50"
},
"discountedPrice": {
"amount": 10.5,
"currencyCode": "USD",
"formattedAmount": "$10.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE1"
},
{
"node": {
"code": "P-36276861",
"brand": "generic",
"isAvailable": true,
"url": "/en/fashion/womens/womens-shoes/p-36276861/",
"placedPrice": {
"amount": 11.5,
"currencyCode": "USD",
"formattedAmount": "$11.50"
},
"discountedPrice": {
"amount": 11.5,
"currencyCode": "USD",
"formattedAmount": "$11.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE2"
},
{
"node": {
"code": "P-42518256",
"brand": "puma",
"isAvailable": true,
"url": "/en/fashion/mens/mens-shoes/p-42518256/",
"placedPrice": {
"amount": 18.5,
"currencyCode": "USD",
"formattedAmount": "$18.50"
},
"discountedPrice": {
"amount": 11.84,
"currencyCode": "USD",
"formattedAmount": "$11.84"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE3"
},
{
"node": {
"code": "P-42313640",
"brand": "concepts",
"isAvailable": true,
"url": "/en/fashion/womens/womens-dresses/p-42313640/",
"placedPrice": {
"amount": 13,
"currencyCode": "USD",
"formattedAmount": "$13.00"
},
"discountedPrice": {
"amount": 13,
"currencyCode": "USD",
"formattedAmount": "$13.00"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE4"
},
{
"node": {
"code": "P-42340084",
"brand": "riders by lee",
"isAvailable": true,
"url": "/en/fashion/womens/womens-dresses/p-42340084/",
"placedPrice": {
"amount": 13.5,
"currencyCode": "USD",
"formattedAmount": "$13.50"
},
"discountedPrice": {
"amount": 13.5,
"currencyCode": "USD",
"formattedAmount": "$13.50"
}
},
"cursor": "YXJyYXljb25uZWN0aW9uOjE5"
}
],
"pageInfo": {
"endCursor": "YXJyYXljb25uZWN0aW9uOjE5",
"hasNextPage": true
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment