Queries

Variants are the specific versions of a product, distinguished by their attributes.

Available queries

Variant - Returns a single variant based on the id provided

query {
  Variant (id: 100012) {
    id
    label
    on_hand
    available
    incoming
    valuation
  }
}

Variants - Returns a list of variants based on the filter define

query {
  Variants {
    data {
    	id
    	label
        sku
    }
  }
}


Available fields

id
Unique identifier of the variant
label
Name of the variant
sku
Sku of the variant
suppliers
Suppliers for the variant
barcode
Barcode of the variant
type
Type of the variant (normal, kit, assembly, packaging)
track_inventory
If true, the inventory is tracked (changed based on documents, adjustments, ...)
initial_cost
Initial cost of the variant
unit_cost
Current cost of the variant
last_cost
Last cost used for the variant
purchase_price_amount
Purchase price of the variant
purchase_price_currency
Currency of the purchase price (GBP, USD, ...)
weight_amount
Weight of the variant
weight_unit
Unit for the variant's weight (kg, g, lb, oz)
active
If false, the product is inactive, and can not be added in documents
created_at
Creation date of the variant
updated_at
Date of the latest modification of the variant
attribute1
Variant attribute for the first option of the product (ex: "red" for Color option)
attribute2
Variant attribute for the second option of the product (ex: "XL" for Size option)
attribute3
Variant attribute for the third option of the product (ex: "iron" for Material option)
product
Product of the variant
shipped_this_month
Quantity of this variant shipped this month
stock_levels
  • Array of StockLevel
Stock levels of the variant on the locations
on_hand
On hand quantity in stocks for the variant
available
Available quantity of the variant
incoming
Incoming quantity for the variant (quantity purchased but not delivered)
reserved
Reserved quantity for the variant (quantity sold but not delivered)
valuation
Valuation of the variant (value of the on hand quantity)
components
List of the components of the variant for a kit or an assembly
component_of
List of the kit or assembly that have this variant as component
packagings
List of the packagings of this variant
has_batch_numbers
If true, the variant has batches
batch_number_stock_levels
  • Array of [BatchNumberStockLevel]
Stock levels by location for the batches of the variant
batch_numbers
  • Array of [BatchNumber]
Batch numbers of the variant


Filters

You can create filters based on following fields

label
Example:{ "column" : "LABEL", "operator" : "LIKE", "value" : "%011%" }
sku
Example: { "column" : "SKU", "operator" : "LIKE", "value" : "DE889%" }
barcode
Example: { "column" : "BARCODE", "operator" : "LIKE", "value" : "111212887%" }
type
Example: { column": "TYPE", "operator": "EQ", "value": "kit"
on_hand
Example:{ "column": "ON_HAND", "operator": "LT", "value": 5 }
available
Example:{ "column": "AVAILABLE", "operator": "LT", "value": 10 }
incoming
Example:{ "column": "INCOMING", "operator": "GT", "value": 100 }
reserved
Example:{ "column": "RESERVED", "operator": "GT", "value": 5 }
track_inventory
Example :{ column": "TRACK_INVENTORY", "operator": "EQ", "value": true }
location_id
Example: { "column": "LOCATION_ID", "operator": "EQ", "value": 1000012 }
bin_location
Example: { "column": "BIN_LOCATION", "operator": "EQ", "value": "loc12" }
supplier_id
Example: { column": "SUPPLIER_ID", "operator": "EQ", "value": 212562 }
supplier_sku
Example: { "column": "SUPPLIER_SKU", "operator": "EQ", "value": "12B5621" }
product_id
Example: { "column": "PRODUCT_ID", "operator": "EQ", "value": 310291 }
shipped_this_month
Example: { "column": "SHIPPED_THIS_MONTH", "operator": "GT", "value": 200 }

Sorting

You can sort data based on following fields : id, label, sku, product_id, barcode, track_inventory, initial_cost, unit_cost, purchase_price_amount, purchase_price_currency, weight_amount, weight_unit, active, created_at, updated_at, shipped_this_month, on_hand, available, incoming, reserved

query Variants(
  $orderBy: [QueryVariantsOrderByOrderByClause!], 
  $first: Int = 50, 
  $page: Int
) {
  Variants(
    orderBy: $orderBy
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      sku
      type
      label
      on_hand
      track_inventory
    }
  }
}
{
  "orderBy": [
    {
      "column": "UNIT_COST",
      "order": "DESC"
    },
  ],
  "first": 50,
  "page": 1,
}

Example of a query

query Variants(
  $where: QueryVariantsWhereWhereConditions, 
  $first: Int = 50, 
  $page: Int
) {
  Variants(
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
      count
      currentPage
      perPage
    }
    data {
      id
      type
      product {
        id
      }
      label
      sku
      on_hand
      available
      reserved
      incoming
    }
  }
}
{
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "TRACK_INVENTORY",
            "operator": "EQ",
            "value": true
          },
          {
            "column": "ACTIVE",
            "operator": "EQ",
            "value": true
          },
          {
            "column": "TYPE",
            "operator": "NEQ",
            "value": "packaging"
          }
        ]
      },
      {
        "AND": [
          {
            "column": "LABEL",
            "operator": "LIKE",
            "value": "%asics coat%"
          },
          {
            "column": "SKU",
            "operator": "LIKE",
            "value": "%j%"
          }
        ]
      }
    ]
  }
}

Example of data returned

{
  "data": {
    "Variants": {
      "paginatorInfo": {
        "total": 2,
        "count": 2,
        "currentPage": 1,
        "perPage": 50
      },
      "data": [
        {
          "id": 100053,
          "type": "normal",
          "product": {
            "id": 100014
          },
          "label": "Impressive Asics Coat - Black - L",
          "sku": "wk831kx8Jt",
          "on_hand": null,
          "available": null,
          "reserved": null,
          "incoming": null
        },
        {
          "id": 100054,
          "type": "normal",
          "product": {
            "id": 100014
          },
          "label": "Impressive Asics Coat - White - XL",
          "sku": "iyy32NjImQ",
          "on_hand": null,
          "available": null,
          "reserved": null,
          "incoming": null
        }
      ]
    }
  }
}


Data types

Variant data type

id
Unique identifier of the variant
label
Name of the variant
sku
SKU of the variant
suppliers
Suppliers and their SKUs for the variant
barcode
Barcode of the variant
track_inventory
If true, the inventory is tracked (changed based on documents, adjustments, ...)
initial_cost
Initial cost of the variant
unit_cost
Current cost of the variant
last_cost
Last cost used for the variant
weight_amount
Weight of the variant
weight_unit
Unit for the variant's weight (kg, g, lb, oz)
weight
Computed weight of the variant
active
If false, the variant is inactive, and can not be added in documents
created_at
Creation date of the variant
updated_at
Date of the latest modification of the variant
has_batch_numbers
If true, the variant has batch numbers
hs_code
HS code of the variant
attributes
Attributes of the variant
attributes_count
Number of attributes of the variant
product
Product of the variant
shipped_this_month
Quantity of this variant shipped this month
shipped_this_month_all_locations
Quantity of this variant shipped this month on all locations
last_sold_date
Date of the last sale of the variant
stock_levels
Stock levels of the variant on the locations
batch_number_stock_levels
Stock levels by location for the batches of the variant
on_hand
On hand quantity of the variant (accepts an optional location_ids argument)
available
Available quantity of the variant (accepts an optional location_ids argument)
incoming
Incoming quantity for the variant (accepts an optional location_ids argument)
reserved
Reserved quantity for the variant (accepts an optional location_ids argument)
bin_location
Bin location of the variant (accepts an optional location_ids argument)
reorder_point
Reorder point of the variant (accepts an optional location_ids argument)
location_label
Label of the location of the variant (accepts an optional location_ids argument)
valuation
Valuation of the variant (value of the on hand quantity; accepts date and location arguments)
dated_on_hand
On hand quantity of the variant for a given date (accepts date and location arguments)
integrations
Integrations of the variant
type
Type of the variant (normal, kit, assembly, packaging)
components
Components of the variant for a kit or an assembly
component_of
Kits or assemblies that use this variant as a component
packagings
Packagings of the variant
batch_numbers
Batch numbers of the variant

SupplierSku data type

variant_id
Unique identifier of the variant
id
Identifier of the supplier
supplier_sku
SKU used by the supplier for this variant
supplier
Supplier of the variant

AttributeVariant data type

variant_id
Unique identifier of the variant
id
Identifier of the attribute
attribute
Attribute linked to the variant
variant
Variant linked to the attribute

VariantComponent data type

id
Unique identifier of the variant component
component
Variant used as component
quantity
Quantity of the component used in the variant
variant
Parent variant using this component


Enums

variantType enum

ValueDescription
normalThe variant is a standard product.
kitThe variant is a kit composed of several components.
assemblyThe variant is an assembly made from components.
packagingThe variant is a packaging of another variant.

stockFromLocationsType enum

ValueDescription
ALLUse all the locations of the company.
ACTIVEUse only the active locations.
INACTIVEUse only the inactive locations.