API Reference

Available queries

Supplier - Returns a single supplier based on the id provided

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

Suppliers - Returns a list of suppliers based on the filter define

query {
  Suppliers {
    data {
    	id
    	label
    }
  }
}


Available fields

id - Int
Unique identifier of the supplier
label - String
Name of the supplier
email - String
Email of the supplier
phone - String
Phone number of the supplier
currency - String
Currency code (EUR, USD, ...)
active - Boolean
If true, the supplier is active and can be assigned to purchases
created_at - DateTime
Creation date of the supplier
updated_at - DateTime
Date of the latest modification of the supplier
address - Address
Address of the supplier


Filters

You can create filters based on following fields

label
Example:{ "column" : "LABEL", "operator" : "LIKE", "value" : "%flowers%" }
phone
Example: { "column" : "PHONE", "operator" : "LIKE", "value" : "066215%" }
email
Example: { column": "EMAIL", "operator": "EQ", "value": "[email protected]"
active
Example:{ "column": "ACTIVE", "operator": "EQ", "value": true }
created_at
Example: { "column": "CREATED_AT", "operator": "LT", "value": "2024-01-11" }
updated_at
Example: { "column": "UPDATED_AT", "operator": "GT", "value": "2024-01-11" }

Sorting

You can sort data based on following fields : id, label, email, phone, active, created_at, updated_at

query Suppliers(
  $orderBy: [QuerySuppliersOrderByOrderByClause!],
  $first: Int = 50, 
  $page: Int
) {
  Suppliers(
    orderBy: $orderBy
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      label
      address {
        country
      }
    }
  }
}
{
  "orderBy": [
    {
      "order": "ASC",
      "column": "EMAIL"
    }
  ],
  "first": 50,
  "page": 1,
}

Example of a query

query Suppliers(
  $where: QuerySuppliersWhereWhereConditions, 
  $first: Int = 50, 
  $page: Int
) {
  Suppliers(
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      label
      email
      phone
      address {
        id
        label
        country
        address_1
        address_2
        postal_code
        city
        state
        phone
      }
      active
    }
  }
}
{
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "COUNTRY",
            "operator": "EQ",
            "value": {
              "id": "GB",
              "label": "United Kingdom",
              "isEuropean": false
            }
          },
          {
            "column": "ACTIVE",
            "operator": "EQ",
            "value": {
              "id": true,
              "label": "Yes"
            }
          }
        ]
      }
    ]
  }
}

Example of data returned

{
  "data": {
    "Suppliers": {
      "paginatorInfo": {
        "total": 2
      },
      "data": [
        {
          "id": 100010,
          "label": "natus",
          "email": "[email protected]",
          "phone": "572-277-6748",
          "address": {
            "id": 100056,
            "label": "molestiae",
            "country": "GB",
            "address_1": "438 O'Reilly Bridge",
            "address_2": "Suite 930",
            "postal_code": "73919",
            "city": "North Maybell",
            "state": null,
            "phone": "+18786974857"
          },
          "active": true
        },
        {
          "id": 100000,
          "label": "quaerat",
          "email": "[email protected]",
          "phone": "635-505-3429",
          "address": {
            "id": 100024,
            "label": "repellendus",
            "country": "GB",
            "address_1": "3077 Beatty Meadow",
            "address_2": "Suite 889",
            "postal_code": "13699",
            "city": "West Jamirchester",
            "state": null,
            "phone": "845-417-5462"
          },
          "active": true
        }
      ]
    }
  }
}