API Reference

Available queries

PurchaseReceipt - Returns a single purchase receipt based on the id provided

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

PurchaseReceipts - Returns a list of purchase receipts based on the filter define

query {
  PurchaseReceipts {
    data {
    	id
    	label
    }
  }
}


Available fields

id - Int
Unique identifier of the purchase receipt
label - String
Title of the purchase receipt
total_units - Float
Total units of the purchase receipt
status - String
Status of the purchase receipt (enum values : pending, cancelled, delivered, unpublished).
dated_at - Date
Date of the purchase receipt
created_at - DateTime
Creation date of the purchase receipt
shipping_at - Date
Date the shipping is planned
shipping_cost - Float
Shipping costs of the purchase receipt
purchase - Purchase - Subquery
Purchase the purchase receipt is created from
line_items - Array of LineItem - Subquery
List of the line items of the purchase receipt
integrations - Integration - Subquery
List of the ID of the items of the integrated solutions linked to this purchase receipt
has_batch_numbers - Boolean
Define if the purchase receipt has batch numbers
tracking_completed - Boolean
If the purchase receipt has batch numbers, are they all allocated


Filters

You can create filters based on following fields

label
Example:{ "column" : "LABEL", "operator" : "LIKE", "value" : "%011%" }
status
Example: { column": "STATUS", "operator": "EQ", "value": {"id": "completed"}
total_units
Example:{ "column": "TOTAL_UNITS", "operator": "GT", "value": 50 }
dated_at
Example: { "column": "DATED_AT", "operator": "EQ", "value": "2024-01-11" }
shipping_at
Example: { "column": "SHIPPING_AT", "operator": "LT", "value": "2024-01-11" }
supplier_id
Example: { "column": "SUPPLIER_ID", "operator": "EQ", "value": 100121 }
variant_id
Purchase receipts 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" }
tracking_completed
Example: { "column": "TRACKING_COMPLETED", "operator": "EQ", "value": {"id": true} }
has_batch_numbers
Example :{ column": "HAS_BATCH_NUMBERS", "operator": "EQ", "value": {"id": true} }

Sorting

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

Example of a query

query PurchaseReceipts(
  $orderBy: [QueryPurchaseReceiptsOrderByOrderByClause!], 
  $where: QueryPurchaseReceiptsWhereWhereConditions, 
  $first: Int = 50, 
  $page: Int
) {
  PurchaseReceipts(
    orderBy: $orderBy
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
      count
      currentPage
      perPage
    }
    data {
      id
      label
      purchase {
        id
        label
        supplier {
          id
          label
        }
      }
      line_items {
        id
        location {
          id
          label
        }
      }
      dated_at
      shipping_at
      total_units
      status
    }
  }
}
{
  "orderBy": [
    {
      "order": "ASC",
      "column": "TOTAL_UNITS"
    }
  ],
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "LOCATION_ID",
            "operator": "EQ",
            "value": {
              "id": 100007,
              "label": "eligendi"
            }
          }
        ]
      }
    ]
  }
}

Example of data returned

{
  "data": {
    "PurchaseReceipts": {
      "paginatorInfo": {
        "total": 2,
        "count": 2,
        "currentPage": 1,
        "perPage": 50
      },
      "data": [
        {
          "id": 100000,
          "label": "PRP00000001",
          "purchase": {
            "id": 100007,
            "label": "P00000008",
            "supplier": {
              "id": 100008,
              "label": "dolorem"
            }
          },
          "line_items": [
            {
              "id": 100175,
              "location": {
                "id": 100007,
                "label": "eligendi"
              }
            },
            {
              "id": 100176,
              "location": {
                "id": 100007,
                "label": "eligendi"
              }
            },
            {
              "id": 100177,
              "location": {
                "id": 100007,
                "label": "eligendi"
              }
            },
            {
              "id": 100178,
              "location": {
                "id": 100007,
                "label": "eligendi"
              }
            }
          ],
          "dated_at": "2024-01-15",
          "shipping_at": "1998-10-16",
          "total_units": 40032.9464847,
          "status": "pending"
        },
        {
          "id": 100002,
          "label": "PRP00000003",
          "purchase": {
            "id": 100007,
            "label": "P00000008",
            "supplier": {
              "id": 100008,
              "label": "dolorem"
            }
          },
          "line_items": [
            {
              "id": 100181,
              "location": {
                "id": 100007,
                "label": "eligendi"
              }
            },
            {
              "id": 100182,
              "location": {
                "id": 100007,
                "label": "eligendi"
              }
            }
          ],
          "dated_at": "2024-01-15",
          "shipping_at": "1998-10-16",
          "total_units": 359783.7905857,
          "status": "pending"
        }
      ]
    }
  }
}