Supplier

Representing a partner of type Supplier.

A Supplier can be connected to certain parts of an Order. The parts of an Order connected to a specific Supplier make up a Suborder.

Properties

Property Description
orderEmail The email address to which order notifications will be sent.
company Company name of supplier.
firstName First name of supplier contact.
lastName Last name of supplier contact.
email Email of supplier contact.

Methods

count

Takes a filter object and returns the number of suppliers found, as an integer.

Parameters

A filter object specifying which suppliers to count. See Filter objects on the page List selection.

Example

The request below returns the number of suppliers found where the company name starts with the characters Libre.

API Console
Supplier.count(
  {
    "/name/en": {
      "startsWith": "Libre"
    }
  }
)
Response
1

get

Fetches a supplier object.

Parameters

Parameter Description
uid The unique identifier of an article choice.
query Which info to return. See Query language.

Example

API Console
Supplier.get(12345, "orderEmail")
Response
{
  "orderEmail": "joe@example.com",
}

getSchema

Parameters

The unique identifier of a supplier.

Example

API Console
Supplier.getSchema(12345)
Response
{
  "uid": {
    "type":        "integer",
    "description": "Supplier UID"
  },
  "company": {
    "type":        "string",
    "description": "The supplier's company name."
  },
  "firstName": {
    "type":        "string",
    "description": "The supplier contact's first name."
  },
  "lastName": {
    "type":        "string",
    "description": "The supplier contact's last name."
  }
  "email": {
    "type":        "string",
    "description": "The supplier's email address.",
    "format":      "email"
  }
}

list

Fetches multiple suppliers as an array of supplier objects.

Parameters

Parameter Description
query Which info to return. See sQuery language.
selection Which articles to list. See List selection.

getSuborders

Retreives all Suborder objects matching a filter, giving a query for what to return.

Parameters

Parameter Description
filter An object for filtering out which Suborder instances to return.
query An object specifying a get-query. See Query language for detailed documentation.
offset Offset to skip. Defaults to 0.
limit Limit the number of Suborders. Default is set to 100 and max to 100.

The filtering object should match the following schema.

JSON
{
  "properties": {
    "deliveryStatus": {
      "type":        "string",
      "description": "Get only the Suborders with this deliveryStatus.",
      "enum": [
        "Shipped",
        "Not shipped"
      ]
    }
  }
}

Example

The request below prints the non-shipped suborder UIDs of the supplier.

API Console
Supplier.getSuborders(12345, {"deliveryStatus": "Not shipped"})
Response
[1234, 6234, 2346, 24356]

The request below prints the non-shipped suborder cost and order UID of the supplier.

API Console
Supplier.getSuborders(12345, {"deliveryStatus": "Not shipped"}, ["uid", "cost", "order"])
Response
[
  {"uid": 1234, "cost": {"incVat": 13.43, "exVat": 10.11, "vat": 3.32}, "order": 5512134},
  {"uid": 2345, "cost": {"incVat": 3.30, "exVat": 1.01, "vat": 2.29}, "order": 5512131}
]