-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgraphql-testing.http
More file actions
120 lines (107 loc) · 3.36 KB
/
graphql-testing.http
File metadata and controls
120 lines (107 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# get from Stencil object settings.storefront_api.token
@apiToken = eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJjaWQiOjEsImNvcnMiOlsiaHR0cHM6Ly93ZWJzaXRlYWR2YW50YWdlLm15YmlnY29tbWVyY2UuY29tIl0sImVhdCI6MTY4NjY1NjQ3MSwiaWF0IjoxNjg2NDgzNjcxLCJpc3MiOiJCQyIsInNpZCI6MjI1MzM5LCJzdWIiOiJiY2FwcC5saW5rZXJkIiwic3ViX3R5cGUiOjAsInRva2VuX3R5cGUiOjF9.u2ewbXR13Bv9doWx3vawaVRmBfrkpWa5ZsJKvxFag22MjRFRRFzQHyqFkOD31vuTuz--Tlmq9AF_TzJ53O04GQ
@domain = websiteadvantage.mybigcommerce.com
### first try
POST https://{{domain}}/graphql HTTP/1.1
Content-Type: application/json
Authorization: Bearer {{apiToken}}
{
"query":
"query Products{site{products(first:25 entityIds:[4,30,33,36,37,44,29,42,39,34,46,24,28,27,26]){edges{node{entityId sku name gtin brand {name} categories{edges{node{name entityId breadcrumbs(depth:10 first:50){edges{node{name}}}}}}twoVariants:variants(first:2){edges{node{entityId sku }}}}}}}}"
}
### neater formatting
POST https://{{domain}}/graphql HTTP/1.1
Content-Type: application/json
Authorization: Bearer {{apiToken}}
X-REQUEST-TYPE: GraphQL
query Products{site{products(first:25 entityIds:[4,30,33,36,37,44,29,42,39,34,46,24,28,27,26]){edges{node{entityId sku name gtin brand {name} categories{edges{node{name entityId breadcrumbs(depth:10 first:50){edges{node{name}}}}}}twoVariants:variants(first:2){edges{node{entityId sku }}}}}}}}
### BC example - need to remove blank lines between the fragments. parameters are specified at the end.
POST https://{{domain}}/graphql HTTP/1.1
Content-Type: application/json
Authorization: Bearer {{apiToken}}
X-REQUEST-TYPE: GraphQL
# Fetch details about a product by its ID
# Stores in pre-launch or maintenance mode may reject queries.
# Access from Control Panel > Advanced Settings > Storefront API Playground
# or browse privately and query against https://buybutton.store/graphql
query productById(
$productId: Int!
# Use GraphQL Query Variables to inject your product ID
) {
site {
product(entityId: $productId) {
id
entityId
name
plainTextDescription
defaultImage {
...ImageFields
}
images {
edges {
node {
...ImageFields
}
}
}
reviewSummary {
summationOfRatings
numberOfReviews
}
prices {
price {
...MoneyFields
}
priceRange {
min {
...MoneyFields
}
max {
...MoneyFields
}
}
salePrice {
...MoneyFields
}
retailPrice {
...MoneyFields
}
saved {
...MoneyFields
}
bulkPricing {
minimumQuantity
maximumQuantity
... on BulkPricingFixedPriceDiscount {
price
}
... on BulkPricingPercentageDiscount {
percentOff
}
... on BulkPricingRelativePriceDiscount {
priceAdjustment
}
}
}
brand {
name
}
}
}
}
fragment ImageFields on Image {
url320wide: url(width: 320)
url640wide: url(width: 640)
url960wide: url(width: 960)
url1280wide: url(width: 1280)
}
fragment MoneyFields on Money {
value
currencyCode
}
{
"productId": 4
}
### check for redirects
# @no-redirect
https://athleticmuscle.net/