PO lines

Lines on a purchase order. Normally sent nested inside the PO.

The object#

FieldTypeDescription
idread-onlyintegerNolaPro id.
invpoidintegerInvpoid. Id only.
itemidintegerReference to items, by id. Write either this or item.
itemstring(255)The sku of the referenced items, instead of the id. Send this or itemid, not both unless they agree.
itemqtyqtystring(6dp)Quantity, 6 decimal places, as a string. Stored as decimal(6dp).
itempricemoneystring(6dp)Stored as decimal(19,6).
detail_descriptionstring(255)Line description printed on the PO.
inv_glacctmoneystringStored as double.
conversionnumberstring(6dp)Numeric string, 6 decimal places. Not money - do not apply currency rounding.
itemvendoridintegerItemvendorid. Id only.
purchaseunitidintegerUnit the line is purchased in, from unitnames.
purchaseunitstring(50)The unitname of the referenced unitnames, instead of the id. Send this or purchaseunitid, not both unless they agree.
itempriceqtyqtystring(5dp)Quantity, 5 decimal places, as a string. Stored as decimal(5dp).
notesstring(500)Free-form notes on the line.
jobidintegerJobid. Id only.
costcodeidintegerCost code.
costcodestring(20)Code for the referenced costcode, instead of the id.
glcategoryidintegerGlcategoryid. Id only.
glcategorystring(20)The code of the referenced glcategories, instead of the id. Send this or glcategoryid, not both unless they agree.
taxableintegerWhether this line is taxed.
detailrowintegerPosition of the line on the PO.
taxmoneystring(6dp)Stored as decimal(19,6).
reqshipdatestringShip date requested from the vendor for this line.
acceptedinteger1 once the line is marked Accepted on the PO screen.
arorderdetailidintegerArorderdetailid. Id only.
donotupdatelastpocostbooleanTrue keeps receipts of this line from updating the item’s last PO cost.
linenumberintegerPosition of this line on its document, starting at 1.
linetypeintegerLine type: 0 = standard product line; other values mark charge lines.
assetidintegerAssetid. Id only.
createassetbooleanTrue creates a fixed asset from the line when it is received.
externalidstring(100)Your own key. Scoped to your company.

Endpoints#

POST/purchaseorderlines/batch 207400409422

Create many.

Requires scope purchaseorders:write.

Parameters
NameInTypeNotes
Body array
FieldTypeDescription
purchaseorderidrequiredintegerThe PO to add to. Refused once it is complete or has receipts.
itemidintegerStock item. Omit for a non-stock line and send a description.
descriptionstring(255)Line text. Defaults to the item description.
quantityrequiredqtystringHow many. Decimal STRING, up to 6 places.
pricemoneystringUnit price. Defaults to 0. Decimal STRING, not a JSON number.
notesstring(500)Line notes.
jobidintegerJob to cost this to.
costcodeidintegerCost code.
externalidstring(100)Your own identifier for this record. Stored verbatim and returned on reads; GET /<resource>?externalid=... finds it again.
When it fails
StatusCodeMeaning
400invalid_requestThe request was malformed.
409line_has_receiptsThe purchase order has receipts against it.
409po_completeThe purchase order is marked complete.
422rule_violationNolaPro refused the document. message carries its reason.
422unknown_valueA reference did not resolve in this company.
curl -X POST \
  'https://acme.nolapro.com/!/api/v2/purchaseorderlines/batch' \
  -H 'Authorization: Bearer $NP_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: your-unique-key' \
  -d '[
    {
        "purchaseorderid": 104,
        "quantity": "3.000000",
        "price": "125.0000",
        "externalid": "crm-8842"
    }
]'
Response 207
{
    "results": [
        {
            "index": 1,
            "status": 1
        }
    ]
}
GET/purchaseorderlines 200403

List po lines.

Requires scope purchaseorders:read.

Parameters
NameInTypeNotes
itemidquerystringRestrict to one itemid.
jobidquerystringRestrict to one jobid.
invpoidquerystringRestrict to one invpoid.
externalidquerystringExact match on your own key.
includequerystringComma-separated extras to embed. Only custom_fields is available: the extra fields this install has defined on the record. Off by default, and an unrecognised value is refused rather than ignored. See Conventions.
When it fails
StatusCodeMeaning
403insufficient_scopeToken lacks read scope.
curl \
  'https://acme.nolapro.com/!/api/v2/purchaseorderlines' \
  -H 'Authorization: Bearer $NP_TOKEN'
POST/purchaseorderlines 201400409422

Create.

Requires scope purchaseorders:write.

Parameters
NameInTypeNotes
Body
FieldTypeDescription
purchaseorderidrequiredintegerThe PO to add to. Refused once it is complete or has receipts.
itemidintegerStock item. Omit for a non-stock line and send a description.
descriptionstring(255)Line text. Defaults to the item description.
quantityrequiredqtystringHow many. Decimal STRING, up to 6 places.
pricemoneystringUnit price. Defaults to 0. Decimal STRING, not a JSON number.
notesstring(500)Line notes.
jobidintegerJob to cost this to.
costcodeidintegerCost code.
externalidstring(100)Your own identifier for this record. Stored verbatim and returned on reads; GET /<resource>?externalid=... finds it again.
When it fails
StatusCodeMeaning
400invalid_requestA required field was missing.
409line_has_receiptsThe purchase order has receipts against it.
409po_completeThe purchase order is marked complete.
422rule_violationNolaPro refused the document. message carries its reason.
422unknown_valueA reference did not resolve in this company.
curl -X POST \
  'https://acme.nolapro.com/!/api/v2/purchaseorderlines' \
  -H 'Authorization: Bearer $NP_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: your-unique-key' \
  -d '{
    "purchaseorderid": 104,
    "quantity": "3.000000",
    "price": "125.0000",
    "externalid": "crm-8842"
}'
Response 201
{
    "purchaseorderid": 104,
    "linenumber": 1,
    "itemqty": "1.000000",
    "itemprice": "125.0000",
    "pototal": "125.0000"
}
GET/purchaseorderlines/{id} 200404

Retrieve one record.

Requires scope purchaseorders:read.

Parameters
NameInTypeNotes
idrequiredpathintegerThe record id.
includequerystringComma-separated extras to embed. Only custom_fields is available: the extra fields this install has defined on the record. Off by default, and an unrecognised value is refused rather than ignored. See Conventions.
When it fails
StatusCodeMeaning
404not_foundNo record with that id.
curl \
  'https://acme.nolapro.com/!/api/v2/purchaseorderlines/104' \
  -H 'Authorization: Bearer $NP_TOKEN'
Response 200
{
    "invpoid": 104,
    "itemid": 104,
    "item": "Example item",
    "itemqty": "1.000000",
    "itemprice": "125.0000",
    "detail_description": "Example detail description"
}
PATCH/purchaseorderlines/{id} 200400404409422

Update.

Requires scope purchaseorders:write.

Parameters
NameInTypeNotes
idrequiredpathintegerThe record id.
Body
FieldTypeDescription
descriptionstring(255)Free text.
itemqtyqtystringQuantity. Re-derives the PO total. Decimal STRING.
itempricemoneystringUnit price. Re-derives the PO total. Decimal STRING.
notesstring(500)Longer notes.
externalidstring(100)Your own identifier for this record.
When it fails
StatusCodeMeaning
400invalid_requestThe request was malformed.
404not_foundNo such record, or it belongs to another company.
409line_has_receiptsThe purchase order has receipts against it.
409po_completeThe purchase order is marked complete.
409stale_recordIf-Match did not match; someone else changed it first.
422rule_violationNolaPro refused the change. message carries its reason.
curl -X PATCH \
  'https://acme.nolapro.com/!/api/v2/purchaseorderlines/104' \
  -H 'Authorization: Bearer $NP_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: your-unique-key' \
  -d '{
    "itemqty": "3.000000",
    "itemprice": "12.5000"
}'
DELETE/purchaseorderlines/{id} 200400404409422

Delete.

Remove a line. invpodetail has no cancel column, so the row is deleted. Answers 200 with the recalculated purchase order. Refused with line_has_receipts once any quantity has been received.

Requires scope purchaseorders:cancel.

Parameters
NameInTypeNotes
idrequiredpathintegerThe record id.
When it fails
StatusCodeMeaning
400invalid_requestThe request was malformed.
404not_foundNo such record, or it belongs to another company.
409cannot_cancelSomething already depends on this document - a payment, a shipment, an invoice.
409line_has_receiptsThe purchase order has receipts against it.
409po_completeThe purchase order is marked complete.
422unknown_valueNo such record in this company.
curl -X DELETE \
  'https://acme.nolapro.com/!/api/v2/purchaseorderlines/104' \
  -H 'Authorization: Bearer $NP_TOKEN'