Fluent Commerce Logo
Docs
Sign In

GraphQL Inventory Queries

Essential knowledge

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