Purchase Orders

Purchase orders are purchases you made by your supplier. You can create a purchase order, then send it to your supplier, and when you receive it in your warehouse create a receipt. The stock will be added to your warehouse when the receipt is created.

Attributes

Name Type Required Description
idpurchaseorder integer generated Unique Picqer reference
idsupplier integer optional Linked to resource Suppliers. If you do not provide a idsupplier, then supplier_name is required.
idtemplate integer optional Linked to resource Templates, if null the default template will be selected
purchaseorderid integer generated Per-account purchase order number
supplier_name string optional Name of the supplier, if no idsupplier is provided.
supplier_orderid string optional Orderid that the supplier gave it
status string generated Status of the order (concept, purchased, received, cancelled)
remarks string optional Remarks about this order (printed on purchase order)
delivery_date string optional Expected delivery date
language string optional Language used for communication with supplier, 'nl' or 'en'
products array required Products in this purchase order
products.idproduct integer required Linked to resource Products
products.amount integer required Amount of products
products.price float optional Override the price

Get all purchase orders

GET https://example.picqer.com/api/v1/purchaseorders
HTTP/1.1 200 OK [ { "idpurchaseorder": 626, "idsupplier": 3, "idwarehouse": 18, "purchaseorderid": "20130013", "supplier_name": null, "supplier_orderid": null, "status": "concept", "remarks": "", "delivery_date": "2013-08-12", "created": "2013-07-17 20:38:35", "updated": "2013-07-17 20:38:35", "products": [ { "idproduct": 147, "idvatgroup": 18, "productcode": "502.052.16", "productcode_supplier": "502.052.16", "name": "SUNDERÖ", "price": 69.95, "amount": 100, "amountreceived": 0, "weight": 10200 } ] }, { "idpurchaseorder": 625, "idsupplier": 3, "idwarehouse": 18, "purchaseorderid": "20130012", "supplier_name": null, "supplier_orderid": null, "status": "concept", "remarks": "", "delivery_date": "2013-08-12", "created": "2013-07-17 20:38:33", "updated": "2013-07-17 20:38:34", "products": [ { "idproduct": 147, "idvatgroup": 18, "productcode": "502.052.16", "productcode_supplier": "502.052.16", "name": "SUNDERÖ", "price": 69.95, "amount": 100, "amountreceived": 0, "weight": 10200 } ] } ]

Filters

You can filter the purchase orders with the following parameters. Add these filters as querystring parameters to the URL.

Attribute Description Example
status Only purchase orders with this status concept
search Search through the fields purchaseorderid, supplier orderid and supplier name.
updatedsince Get the purchase orders that are changed since this date and time. 2015-01-01 12:00:00

Get single purchase order

GET https://example.picqer.com/api/v1/purchaseorders/{idpurchaseorder}
HTTP/1.1 200 OK { "idpurchaseorder": 625, "idsupplier": 3, "idwarehouse": 18, "purchaseorderid": "20130012", "supplier_name": null, "supplier_orderid": null, "status": "concept", "remarks": "", "delivery_date": "2013-08-12", "created": "2013-07-17 20:38:33", "updated": "2013-07-17 20:38:34", "products": [ { "idproduct": 147, "idvatgroup": 18, "productcode": "502.052.16", "productcode_supplier": "502.052.16", "name": "SUNDERÖ", "price": 69.95, "amount": 100, "amountreceived": 0, "weight": 10200 } ] }

Create new purchase order

POST https://example.picqer.com/api/v1/purchaseorders
{ "idsupplier": 3, "idwarehouse": 18, "products": [ { "idproduct": 147, "price": 26.95, "amount": 25 } ] }
HTTP/1.1 201 Created { "idpurchaseorder": 627, "idsupplier": 3, "idwarehouse": 18, "purchaseorderid": "20130014", "supplier_orderid": null, "status": "concept", "remarks": null, "delivery_date": null, "created": "2013-07-17 21:39:40", "updated": "2013-07-17 21:39:40", "products": [ { "idproduct": 147, "idvatgroup": 18, "productcode": "502.052.16", "productcode_supplier": "502.052.16", "name": "SUNDERÖ", "price": 26.95, "amount": 25, "amountreceived": 0, "weight": 10200 } ] }

Mark purchase order as purchased

Only 'concept' purchase orders can be marked as purchased.

POST https://example.picqer.com/api/v1/purchaseorders/{idpurchaseorder}/mark-as-purchased
HTTP/1.1 200 OK { "idpurchaseorder": 627, "idsupplier": 3, "idwarehouse": 18, "purchaseorderid": "20130014", "supplier_name": null, "supplier_orderid": null, "status": "purchased", "remarks": null, "delivery_date": null, "created": "2013-07-17 21:39:40", "updated": "2013-07-17 21:39:40", "products": [ { "idproduct": 147, "idvatgroup": 18, "productcode": "502.052.16", "productcode_supplier": "502.052.16", "name": "SUNDERÖ", "price": 26.95, "amount": 25, "amountreceived": 0, "weight": 10200 } ] }

Update purchase order

You can change a purchase order after you created it.

PUT https://example.picqer.com/api/v1/purchaseorders/{idpurchaseorder}
{ "remarks": "Automatically purchased at supplier", "supplier_orderid": "882636-229" }
HTTP/1.1 200 OK { "idpurchaseorder": 627, "idsupplier": 3, "idwarehouse": 18, "purchaseorderid": "20130014", "supplier_name": null, "supplier_orderid": "882636-229", "status": "cancelled", "remarks": "Automatically purchased at supplier", "delivery_date": null, "created": "2013-07-17 21:39:40", "updated": "2019-07-19 11:21:12", "products": [ { "idproduct": 147, "idvatgroup": 18, "productcode": "502.052.16", "productcode_supplier": "502.052.16", "name": "SUNDERÖ", "price": 26.95, "amount": 25, "amountreceived": 0, "weight": 10200 } ] }

Cancel purchase order

Purchase orders can only be cancelled when they have the status 'concept' or 'purchased'.

POST https://example.picqer.com/api/v1/purchaseorders/{idpurchaseorder}/cancel
HTTP/1.1 200 OK { "idpurchaseorder": 627, "idsupplier": 3, "idwarehouse": 18, "purchaseorderid": "20130014", "supplier_name": null, "supplier_orderid": null, "status": "cancelled", "remarks": null, "delivery_date": null, "created": "2013-07-17 21:39:40", "updated": "2013-07-17 21:39:40", "products": [ { "idproduct": 147, "idvatgroup": 18, "productcode": "502.052.16", "productcode_supplier": "502.052.16", "name": "SUNDERÖ", "price": 26.95, "amount": 25, "amountreceived": 0, "weight": 10200 } ] }

Receipts

To receive products from a purchase order, see the Receipts endpoint.

Products

You can use the endpoint /api/v1/purchaseorders/{idpurchaseorder}/products to get the details of products in a purchase order.

To add a new product to an existing purchase order, you can POST that product with the following example.

You can only add 1 product per call. Required fields are: idproduct and amount. The price and delivery_date fields are optional.

POST https://example.picqer.com/api/v1/purchaseorders/{idpurchaseorder}/products
{ "idproduct": 1105257, "price": 12.95, "amount": 1 }
HTTP/1.1 200 OK { "idpurchaseorder_product": 1272513, "idproduct": 1105257, "idvatgroup": 5, "productcode": "AR2954212", "productcode_supplier": "28372736", "name": "Philips Hue kit", "price": 12.95, "amount": 1, "amountreceived": 0, "delivery_date": null, "weight": 1793 }

To update a product, you can send a PUT request to endpoint /api/v1/purchaseorders/{idpurchaseorder}/products/{idpurchaseorder_product} to update amount, price or delivery_date.

To delete a product, send a DELETE request to endpoint /api/v1/purchaseorders/{idpurchaseorder}/products/{idpurchaseorder_product}. You can only remove products that are not received yet.

Read more Returns