Fluent Commerce Logo
Docs
Sign In

GraphQL Cheatsheet

Topic

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

  • Collection of GraphQL samples handy for accessing Fluent OMS

GraphQL Inventory Queries

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

Sample Inventory Queries that can be used on a daily basis.

Key points

  • An actual example of a GraphQL query on the following:
    • Inventory Position by Details
    • Inventory Position by Reference
    • Inventory Positions
    • Inventory Quantity Updated

Inventory Position by Details

Retrieve inventory positions based on details 

`productRefs`
 and 
`locationRef`
 including the corresponding inventory quantities.

Example Query:

1query QueryInventoryPositionByDetails($inventoryCatalgoueRef:String!, $productRefs:[String!], $locationRefs:[String!]) {
2  inventoryPositions(catalogue: {ref: $inventoryCatalgoueRef}, productRef: $productRefs, locationRef: $locationRefs) {
3    edges {
4      node {
5        ref
6        productRef
7        locationRef
8        onHand
9        updatedOn
10        quantities {
11          edges {
12            node {
13              ref
14              quantity
15              type
16              status
17              updatedOn
18              createdOn
19            }
20          }
21        }
22      }
23    }
24  }
25}

Language: json

Name: Inventory Position by Detail Query

Description:

Inventory Position by Details

Example Parameters:

1{
2  "inventoryCatalgoueRef": "DEFAULT:1",
3  "productRefs": ["20773500011", "20773500010"],
4  "locationRefs": ["0952"]
5}

Language: json

Name: Inventory Position by Detail Parameter

Description:

Inventory Position by Detail Parameter




Inventory Position by Reference

Retrieve an inventory position based on a specific ref. In the default setup, an inventory position reference follows the format: "

`<productRef>:<locationRef>:DEFAULT`
"

Example Query:

1query QueryInventoryPositionByRef($inventoryCatalgoueRef:String!, $invPositionRef:String!) {
2  inventoryPosition(catalogue: {ref: $inventoryCatalgoueRef }, ref: $invPositionRef) {
3      ref
4      productRef
5      locationRef
6      quantities {
7        edges {
8          node {
9            quantity
10            type
11          }
12        }
13      }
14    }
15}

Language: json

Name: Inventory Position by Reference Query

Description:

Inventory Position by Reference

Example Parameters:

1{
2  "inventoryCatalgoueRef": "DEFAULT:1",
3  "invPositionRef": "20773500010:0952:DEFAULT"
4}

Language: json

Name: Inventory Position by Reference

Description:

Inventory Position by Reference Parameter



Inventory Positions

Retrieve inventory positions and specific inventory quantities (

`LAST_ON_HAND`
,
`RESERVED`
,
`CORRECTION`
) by paginating through the records with a cursor.

Example Query:

1query QueryInventoryPositions($count:Int!, $ inventoryCatalgoueRef:String!, $invPositionCursor: String){
2    inventoryPositions(catalogue: {ref:$inventoryCatalgoueRef}, first:$count, after:$invPositionCursor) {
3        edges {
4            node {
5                productRef
6                storeNo:locationRef
7                inventoryQty:quantities(type:"LAST_ON_HAND"){
8                    edges{
9                        node{
10                            quantity
11                        }
12                    }
13                }
14                reserveQty:quantities(type:"RESERVED") {
15                    edges {
16                        node {
17                            quantity
18                        }
19                    }
20                }
21                correctionQty:quantities(type:"CORRECTION") {
22                    edges {
23                        node {
24                            quantity
25                        }
26                    }
27                }
28            }
29            cursor
30        }
31        pageInfo{
32            hasNextPage
33        }
34    }
35}

Language: json

Name: Inventory Positions

Description:

Inventory Positions

Example Parameters:

1
2{
3  "count": 100,
4  "inventoryCatalgoueRef": "DEFAULT:1",
5  "invPositionCursor": "Y3Vyc29yOi0tLWU2dds2OTEwLTc4ODktNDA3Zi1hM2VkLTY3ZDhkZjI5Y2RjNF9fMTU3MzIyODM0MzQ1Ng=="
6}

Language: json

Name: Inventory Positions

Description:

Inventory Positions



Inventory Quantity Updated

Retrieve inventory quantities (type:

`LAST_ON_HAND`
) that have been updated in a specific timeframe.

Example Query:

1query QueryInventoryQuantityUpdated($count:Int!, $inventoryCatalgoueRef:String!, $from:DateTime!, $to:DateTime!){
2inventoryQuantities(catalogue: {ref: $inventoryCatalgoueRef },
3    updatedOn: {from: $from, to: $to},
4    type: "LAST_ON_HAND",
5   first:$count) {
6    edges {
7      node {
8        ref
9        quantity
10        type
11        updatedOn
12      }
13      cursor
14    }
15    pageInfo {
16      hasNextPage
17    }
18  }
19}

Language: json

Name: Inventory Quantity Query

Description:

Inventory Quantity Updated

Example Parameters:

1{
2  "count": 100,
3  "inventoryCatalgoueRef": "DEFAULT:1",   
4  "from": "2019-10-01T00:00:00.000Z",
5  "to": "2019-10-01T23:59:59.999Z"
6}

Language: json

Name: Inventory Quantity Updated

Description:

Inventory Quantity Updated Parameter


GraphQL Product Queries

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

Sample Product Queries that can be used on a daily basis

Key points

  • Sample Queries on the following:
    • Variant Product (SKU) by Reference
    • Variant Product (SKU) by Details
    • Variant Products (SKU)

Variant Product (SKU) by Reference

Retrieve a variant product (SKU) based on a reference.

Example Query:

1query QueryVariantProduct ($productCatalgoueRef:String!, $ref:String!){
2  variantProduct(catalogue: {ref:$productCatalgoueRef }, ref: $ref) {
3    id
4    ref
5    name
6    gtin
7    attributes {
8      name
9      value
10    }
11    prices {
12      value
13    }
14    status
15  }
16}

Language: json

Name: variant Product (SKU) by Reference - Query

Description:

variant Product (SKU) by Reference - Query

Example Parameters:

1{
2  "productCatalgoueRef": "COMPATIBILITY:1",
3  "ref":"19092800045"
4}

Language: json

Name: variant Product (SKU) by Reference - Parameter

Description:

variant Product (SKU) by Reference - Parameter


Variant Product (SKU) by Details

Retrieve a variant product (SKU) based on details productRefs and statuses.

Example Query:

1query QueryVariantProductByDetail($productCatalgoueRef:String!, $productRefs:[String!], $statuses:[String!]) {
2  variantProducts(catalogue: {ref: $productCatalgoueRef}, ref: $productRefs, status: $statuses) {
3    edges {
4      node {
5        id
6        ref
7        name
8        product {
9          id
10          name
11          ref
12        }
13        attributes {
14          name
15          value
16        }
17        prices {
18          value
19        }
20        status
21      }
22    }
23  }
24}

Language: json

Name: variant Product (SKU) by Details - Query

Description:

variant Product (SKU) by Details - Query

Example Parameters:

1{
2  "productCatalgoueRef": "COMPATIBILITY:1",
3  "productRefs": ["19092800045"],
4  "statuses":["ACTIVE"]
5}

Language: json

Name: variant Product (SKU) by Details - Parameter

Description:

variant Product (SKU) by Details - Parameter



Variant Products (SKU) 

Retrieve variant products by paginating through the records.

Example Query:

1query QueryVariantProducts($count: Int!, $productCatalogueRef: String!, $variantPrdCursor: String) {
2  variantProducts(first: $count, catalogue: {ref: $productCatalogueRef},  after: $variantPrdCursor) {
3    edges {
4      node {
5        id
6        ref
7        name
8        product {
9          id
10          ref
11          name
12        }
13        attributes {
14          name
15          value
16        }
17        prices {
18          value
19        }
20      }
21      cursor
22    }
23    pageInfo {
24      hasNextPage
25    }
26  }
27}

Language: json

Name: variant Products (SKU) - Query

Description:

variant Products (SKU) - Query

Example Parameters:

1{
2  "productCatalogueRef": "DEFAULT:1",
3  "count": 100
4}

Language: json

Name: variant Products (SKU) - Parameter

Description:

variant Product (SKU) by Reference - Parameter

Virtual Position Queries

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

Sample Virtual Position Queries that can be used on a daily basis

Key points

  • Query sample on extract virtual position by updatedOn

Virtual Position by updatedOn

Retrieve Virtual positions which have updated in a specific timeframe

Example Query:

1query QueryVirtualPositions($virtualCatalogueRef: String!, $from: DateTime!, $to: DateTime) {
2  virtualPositions(catalogue: {ref: $virtualCatalogueRef}, updatedOn: {from: $from, to: $to}) {
3    edges {
4      node {
5        ref
6        catalogue {
7          ref
8        }
9        quantity
10        status
11      }
12    }
13  }
14}

Language: json

Name: Virtual positions - Query

Description:

Virtual positions - Query

Example Parameters:

1
2{
3  "virtualCatalogueRef": "BASE:1",
4  "from": "2019-10-01T00:00:00.000Z",
5  "to": "2019-10-01T23:59:59.999Z"
6}

Language: json

Name: Virtual positions - Parameter

Description:

Virtual positions - Parameter


GraphQL All-In-One Inventory Queries

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

Retrieve inventory position, variant product, virtual base position and virtual aggregate position records based on input parameters.


Key points

  • Sample GraphQL query that extracts inventory position, variant product, virtual position and virtual aggregate position. 

Inventory Position, Variant Product, Virtual Base & Aggregate Position

Retrieve inventory position, variant product, virtual base position and virtual aggregate position records based on input parameters.

Example Query:

1query QueryInventoryWithProducts($inventoryCatalogueRef: String!,
2  $productCatalogueRef: String!,
3  $baseVirtualCatalogueRef: String!,
4  $aggregateVirtualCatalogueRef: String!,
5  $productRefs:[String!],
6  $locationRefs:[String!]) {
7  inventoryPositions(catalogue: {ref: $inventoryCatalogueRef}, productRef: $productRefs, locationRef:$locationRefs) {
8    edges {
9      node {
10        ref
11        status
12        productRef
13        locationRef
14        onHand
15      }
16    }
17  }
18  locations(ref:$locationRefs){
19    edges{
20      node{
21        ref
22        status
23      }
24    }
25  } 
26  variantProducts(catalogue:{ref:$productCatalogueRef} ref:$productRefs) {
27    edges {
28      node {
29        ref
30        status
31        name
32      }
33    }
34  }
35  base:virtualPositions(catalogue:{ref:$baseVirtualCatalogueRef} productRef:$productRefs, type:"BASE", groupRef:$locationRefs) {
36    edges {
37      node {
38        ref
39        status
40        quantity
41        type
42      }
43    }
44  }
45  ats:virtualPositions(catalogue:{ref:$aggregateVirtualCatalogueRef} productRef:$productRefs, type:"AGGREGATE") {
46    edges {
47      node {
48        ref
49        status
50        quantity
51        type
52      }
53    }
54  }
55}

Language: json

Name: Inventory with Products - Query

Description:

Inventory with Products - Query

Example Parameters:

1
2{
3  "inventoryCatalogueRef": "DEFAULT:1",
4  "productCatalogueRef": "COMPATIBILITY:1",
5  "baseVirtualCatalogueRef": "BASE:1",
6  "productRefs": ["20773500011"],
7  "aggregateVirtualCatalogueRef": "GP_RETAILER_HD:1",
8  "locationRefs": ["0952"]
9}

Language: json

Name: Inventory with Products - Parameter

Description:

Inventory with Products - Parameter


GraphQL order by ID with flags in parameter

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

Retrieve an order by

`id`
with flags to drive the retrieval of sub-entities.


Key points

  • Sample query on how to use flags as part of the query parameter

Inventory Position, Variant Product, Virtual Base & Aggregate Position

Retrieve inventory position, variant product, virtual base position and virtual aggregate position records based on input parameters.

Example Query:

1query getOrderById(
2    $id: ID!,
3    $includeCustomer: Boolean!,
4    $includeAttributes: Boolean!,
5    $includeFulfilmentChoice: Boolean!,
6    $includeFulfilments: Boolean!,
7    $includeOrderItems: Boolean!,
8    $includeArticles: Boolean!,
9    $includeConsignmentArticles: Boolean!,
10    $includeFinancialTransactions: Boolean!,
11    $articleCount: Int,
12    $articleCursor: String,
13    $fulfilmentItemCount: Int,
14    $fulfilmentItemCursor: String,
15    $fulfilmentCount: Int,
16    $fulfilmentCursor: String,
17    $orderItemCount: Int,
18    $orderItemCursor: String,
19    $financialTransactionsCount: Int,
20    $financialTransactionsCursor: String,
21    $consignmentArticlesCount: Int,
22    $consignmentArticlesCursor: String) {
23  order: orderById(id: $id) {
24    id
25    ref
26    type
27    status
28    createdOn
29    updatedOn
30    totalPrice
31    totalTaxPrice
32    attributes @include(if: $includeAttributes) {
33      name
34      value
35      type
36    }
37    financialTransactions(first: $financialTransactionsCount, after: $financialTransactionsCursor) @include(if: $includeFinancialTransactions) {
38      edges {
39        node {
40          id
41          ref
42          type
43          status
44          createdOn
45          updatedOn
46          total
47          currency
48          externalTransactionCode
49          externalTransactionId
50          cardType
51          paymentMethod
52          paymentProviderName
53        }
54        cursor
55      }
56      pageInfo {
57        hasNextPage
58      }
59    }
60 
61    items(first: $orderItemCount, after: $orderItemCursor) @include(if: $includeOrderItems) {
62      itemEdges: edges {
63        itemNode: node {
64          id
65          ref
66          quantity
67          paidPrice
68          currency
69          price
70          taxPrice
71          totalPrice
72          totalTaxPrice
73          status
74 
75          product {
76            ... on VariantProduct {
77              ref
78              name
79              summary
80              catalogue {
81                ref
82              }
83            }
84          }
85          attributes{
86            name
87            type
88            value
89          }
90        }
91        cursor
92      }
93      pageInfo {
94        hasNextPage
95      }
96    }
97    fulfilments(first: $fulfilmentCount, after: $fulfilmentCursor) @include(if: $includeFulfilments) {
98      fulfilmentEdges: edges {
99        fulfilmentNode: node {
100          id
101          ref
102          type
103          status
104          type
105          createdOn
106          updatedOn
107          fromAddress {
108            ref
109            id
110            name
111          }
112          toAddress {
113            ref
114            id
115          }
116          attributes{
117            name
118            type
119            value
120          }
121          fulfilmentItems: items(first: $fulfilmentItemCount, after: $fulfilmentItemCursor) {
122            fulfilmentItemEdges: edges {
123              fulfilmentItemNode: node {
124                id
125                ref
126                status
127                requestedQuantity
128                filledQuantity
129                rejectedQuantity
130                orderItem {
131                  id
132                  ref
133                  status
134                  quantity
135                  paidPrice
136                  currency
137                  price
138                  taxPrice
139                  taxType
140                  totalPrice
141                  totalTaxPrice
142 
143                  attributes{
144                    name
145                    type
146                    value
147                  }
148                  product {
149                    ... on VariantProduct {
150                      name
151                      ref
152                      gtin
153                      summary
154                      type
155                      prices{
156                        value
157                      }
158                      catalogue{
159                        id
160                        ref
161                      }
162                   }
163                }
164                }
165              }
166              cursor
167            }
168            pageInfo {
169              hasNextPage
170            }
171          }
172          articles(first: $articleCount, after: $articleCursor) @include(if: $includeArticles) {
173            edges {
174              node {
175                id
176                ref
177                type
178                status
179                quantity
180                carrierConsignmentArticles(first: $consignmentArticlesCount, after: $consignmentArticlesCursor) @include(if: $includeConsignmentArticles) {
181                  edges {
182                    node {
183                      carrierConsignment {
184                        id
185                        ref
186                        trackingLabel
187                        labelUrl
188                        orderSummaryUrl
189                        carrier {
190                          id
191                          name
192                          ref
193                        }
194                      }
195                    }
196                  }
197                }
198              }
199              cursor
200            }
201            pageInfo {
202              hasNextPage
203            }
204          }
205        }
206        cursor
207      }
208      pageInfo {
209        hasNextPage
210      }
211    }
212    customer @include(if: $includeCustomer) {
213      id
214      ref
215      title
216      country
217      firstName
218      lastName
219      username
220      primaryEmail
221      primaryPhone
222    }
223    fulfilmentChoice @include(if: $includeFulfilmentChoice) {
224      id
225      createdOn
226      updatedOn
227      currency
228      deliveryInstruction
229      fulfilmentPrice
230      deliveryType
231      fulfilmentPrice
232      fulfilmentType
233      fulfilmentTaxPrice
234      pickupLocationRef
235      deliveryAddress {
236        id
237        type
238        companyName
239        name
240        street
241        city
242        state
243        postcode
244        region
245        country
246        region
247        ref
248        latitude
249        longitude
250      }
251    }
252  }
253}

Language: json

Name: getOrderById - query

Description:

getOrderById - query

Example Parameters:

1{
2  "id": 133,
3  "includeArticles": false,
4  "includeCustomer": false,
5  "includeOrderItems": true,
6  "includeAttributes": true,
7  "includeFulfilments": false,
8  "includeFulfilmentChoice": false,
9  "includeConsignmentArticles": false,
10  "includeFinancialTransactions": false,
11  "articleCount": 100,
12  "fulfilmentCount": 100,
13  "fulfilmentItemCount": 100,
14  "orderItemCount": 100,
15  "financialTransactionsCount": 100,
16  "consignmentArticlesCount": 100
17}

Language: json

Name: getOrderById - Parameter

Description:

getOrderById - Parameter


Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo