Queries

Available queries

Order - Returns a single order based on the id provided

query {
  Order (id: 100012) {
    id
    label
  }
}

Orders - Returns a list of order based on the filter define

query {
  Orders {
    data {
    	id
    	label
    }
  }
}


Available fields

id
Unique identifier of the order
label
Title of the order
notes
Notes attached to the order
total_units
Total units of the order
status
Status of the order (enum values : active, archived, cancelled, completed, unpublished)
update_on_hand
If true, the order will update the on hand stock levels. If false, the order will update the available stock levels, and only the delivery will update the on hand stock levels.
dated_at
Date of the order
available_for_shipping
If true, the order is available for shipping (relevant stock levels)
customer
Customer of the order
shipping_address
Shipping address of the order
shipping_at
Date the shipping is planned
need_reorder
If true, quantities of some line items need to be re-order
committed
Quantity already added to a shipping order
reserved
Quantity reserved
delivered
Quantity already delivered
shipped
Quantity already shipped
shipping_orders
List of the shipping orders created from that order
product_returns
List of the product returns created from that order
line_items
List of the line items of the order
purchases
List of the purchases created for this order
integrations
List of the ID of the items of the integrated solutions linked to this order
has_batch_numbers
Define if the order has batch numbers
tracking_completed
If the order has batch numbers, are they all allocated


Filters

You can create filters based on following fields

label
Example:{ "column" : "LABEL", "operator" : "LIKE", "value" : "%011%" }
notes
Example: { "column" : "NOTES", "operator" : "LIKE", "value" : "Duplicated from O000001%" }
status
Example: { column": "STATUS", "operator": "EQ", "value": {"id": "completed"}
total_units
Example:{ "column": "TOTAL_UNITS", "operator": "GT", "value": 50 }
update_on_hand
Example :{ column": "UPDATE_ON_HAND", "operator": "EQ", "value": {"id": true} }
dated_at
Example: { "column": "DATED_AT", "operator": "EQ", "value": "2024-01-11" }
customer_id
Example: { "column": "CUSTOMER_ID", "operator": "EQ", "value": {"id": 100002} }
available_for_shipping
Example: { column": "AVAILABLE_FOR_SHIPPING", "operator": "EQ", "value": {"id": true} }
committed
Example: { "column": "COMMITTED", "operator": "GT", "value": 149.09 }
shipping_at
Example: { "column": "SHIPPING_AT", "operator": "LT", "value": "2024-01-11" }
delivered
Example: { "column": "DELIVERED", "operator": "LT", "value": 349 }
reserved
Example: { "column": "RESERVED", "operator": "EQ", "value": 1000 }
shipped
Example: { "column": "SHIPPED", "operator": "LT", "value": 349 }
need_reorder
Example: { column": "NEED_REORDER", "operator": "EQ", "value": {"id": true} }
variant_id
Orders containing this variant
Example: { "column": "VARIANT_ID", "operator": "EQ", "value": 100076 }
variant_label
Example: { "column": "VARIANT_LABEL", "operator": "EQ", "value": "NICE SHOES" }
variant_sku
Example: { "column": "VARIANT_SKU", "operator": "EQ", "value": "10ABC45" }
location_id
Example: { "column": "LOCATION_ID", "operator": "EQ", "value": "100245" }
batch_number_id
Example: { "column": "BATCH_NUMBER_ID", "operator": "EQ", "value": "100024" }
batch_number_label
Example: { "column": "BATCH_NUMBER_LABEL", "operator": "EQ", "value": "My batch" }
has_batch_numbers
Example :{ column": "HAS_BATCH_NUMBERS", "operator": "EQ", "value": {"id": true} }

Sorting

You can sort data based on following fields : id, label, notes, total_units, status, update_on_hand, dated_at, created_at, shipping_at, customer_id

query Orders(
  $orderBy: [QueryOrdersOrderByOrderByClause!],
  $where: QueryOrdersWhereWhereConditions,
  $first: Int,
  $page: Int
) {
  Orders(
    orderBy: $orderBy
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
      count
      currentPage
      perPage
    }
    data {
      id
      label
      customer {
        id
        label
      }
      dated_at
      shipping_at
      total_units
      status
      committed
      shipped
      delivered
    }
  }
}
{
  "orderBy": [
    {
      "column": "DATED_AT",
      "order": "DESC"
    },
    {
      "column": "CREATED_AT",
      "order": "DESC"
    }
  ],
  "first": 50,
  "page": 1
}

Example of a query

query Orders(
  $orderBy: [QueryOrdersOrderByOrderByClause!],
  $where: QueryOrdersWhereWhereConditions,
  $first: Int,
  $page: Int
) {
  Orders(
    orderBy: $orderBy
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      label
      customer {
        id
        label
      }
      dated_at
      shipping_at
      total_units
    }
  }
}
{
  "orderBy": [
    {
      "column": "DATED_AT",
      "order": "DESC"
    },
    {
      "column": "CREATED_AT",
      "order": "DESC"
    }
  ],
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "STATUS",
            "operator": "EQ",
            "value": {
              "id": "active",
            }
          },
          {
            "column": "SHIPPING_AT",
            "operator": "GT",
            "value": "2020-01-01"
          },
          {
            "column": "CUSTOMER_ID",
            "operator": "EQ",
            "value": {
              "id": 100000,
            }
          }
        ]
      }
    ]
  }
}

Example of data returned

{
  "data": {
    "Orders": {
      "paginatorInfo": {
        "total": 1,
        "count": 1,
        "currentPage": 1,
        "perPage": 50
      },
      "data": [
        {
          "id": 100006,
          "label": "O00000007",
          "customer": {
            "id": 100000,
            "label": "Zieme"
          },
          "dated_at": "1021-07-02",
          "shipping_at": "2022-03-16",
          "total_units": 21,
        }
      ]
    }
  }
}