An object representing a purchase order for the current shop. At the present moment purchase orders are used to indicate when a product that is out of stock is expected to be in stock again.
To be able to access this API class the webshop must have enabled the purchase orders functionality.
Property | Type | Description |
---|---|---|
uid | integer | The unique identifier of the purchase order. |
reference | string | A unique reference to the purchase order, for example a referense to the purchase order in an external system. The reference can be set only when creating a new purchase order, it can not be changed after that. |
status | string | The status of the pruchase orders, valid values are "active" and "inactive". |
Creates a new purchase order. This is shorthand for set with the unique identifier null
.
Parameters | Description |
---|---|
reference | A unique reference to the purchase order. |
status | Valid values are "active" and "inactive". |
Removes an existing purchase order.
Parameters | Description |
---|---|
uid | UID of object to delete. |
Fetches information about a purchase order.
Parameter | Description |
---|---|
uid | The unique identifier of the purchase order. |
query | Which info to return. See Query language. |
PurchaseOrder.get(12345)
Fetches the JSON Schema which can be used for client-side validation.
The unique identifier of the purchase order.
Returns an array of objects representing purchase orders.
PurchaseOrder.list(true, {
"filters": {
"/status": "active"
}
})
PurchaseOrder.list(true, {
"filters": {
"/reference": "my unique reference"
}
})
Parameter | Description |
---|---|
query | Which info to return. See Query language. |
selection | Which purchase orders to list. See List selection. |
Utility method to simplify getting a purchase order with given referens, see example 3 above.
Parameter | Description |
---|---|
reference | The unique reference of the purchase order |
query | A query specifying what to return after a successful set (optional). See Query language. |
PurchaseOrder.getByReference("my unique reference", true)
Creates or updates a purchase order.
Parameter | Description |
---|---|
uid | The unique identifier of the purchase order or null to create a new purchase order. |
patch | An object containing the properties and values to set for the purchase order. |
query | A query specifying what to return after a successful set (optional). See Query language. |
PurchaseOrder.set(1, {
"status": "inactive"
}, true)
Utitility method to simplify adding or updating purchase order iten (a product) in the purchase order.
Parameter | Description |
---|---|
uid | The unique identifier of the purchase order |
item | An object refresentoing containing the properties and values to set for the purchase order. See below. |
query | A query specifying what to return after a successful set (optional). See Query language and Purchase order item. |
Parameter | Description |
---|---|
articleUid | The unique identifier of the article |
variantUid | The unique identifier of the article variant |
articleNumber | The article number of the article or variant of article |
quantity | How many items has been ordered |
deliveryDate | Expected delivery date |
Please note that you must specify one, and only one, of articleUid, variantUid or articleNumber.
Add or update PurchaseOrderItem for Article or ArticleVariant with article number "hat".
PurchaseOrder.setItem(1, {
"articleNumber": "hat",
"quantity": 18,
"deliveryDate": "2024-08-13"
}, true)
Add or update PurchaseOrderItem for Article with Uid 12345.
PurchaseOrder.setItem(1, {
"articleUid": 12345,
"quantity": 50,
"deliveryDate": "2024-08-30"
}, true)
Add or update PurchaseOrderItem for ArticleVariant with Uid 54321.
PurchaseOrder.setItem(1, {
"variantUid": 54321,
"quantity": 50,
"deliveryDate": "2024-08-30"
}, true)