Order lines

Lines on an order. Normally sent nested inside the order. arorderdetail has no cancel column, so DELETE removes the row and renumbers its siblings rather than cancelling it.

The object#

FieldTypeDescription
idread-onlyintegerNolaPro id.
orderidintegerOrderid. 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.
linenumberintegerPosition of this line on its document, starting at 1.
qtyorderqtystring(6dp)Quantity, 6 decimal places, as a string. Stored as decimal(6dp).
qtyshipqtystring(6dp)Quantity, 6 decimal places, as a string. Stored as decimal(6dp).
qtybillqtystring(6dp)Quantity, 6 decimal places, as a string. Stored as decimal(6dp).
glaccountidintegerReference to glaccounts, by id. Write either this or glaccount.
glaccountstring(20)Code for the referenced glaccount, instead of the id.
taxflagintegerWhether the first line tax applies. NolaPro carries up to three taxes per line.
costeachmoneystring(6dp)Stored as decimal(19,6).
priceachmoneystring(6dp)Stored as decimal(19,6).
entrydatestringWhen the record was created.
lastchangedateread-onlystringLast modification. Drives modifiedsince.
products_taxmoneystring(4dp)Stored as decimal(7,4).
descriptionstring(255)Line description printed on the order.
saleunitperpriceunitnumberstring(6dp)Numeric string, 6 decimal places. Not money - do not apply currency rounding.
costglaccountidintegerReference to glaccounts, by id. Write either this or costglaccount.
costglaccountstring(20)The name of the referenced glaccounts, instead of the id. Send this or costglaccountid, not both unless they agree.
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.
priceunitidintegerUnit the line is priced in, from unitnames.
priceunitstring(50)The unitname of the referenced unitnames, instead of the id. Send this or priceunitid, not both unless they agree.
main_arorderdetailidintegerMain arorderdetailid. Id only.
itemoptiongroupidintegerItemoptiongroupid. Id only.
itemoptionidintegerItemoptionid. Id only.
multioptioninteger1 when the line is an option row belonging to a multi-option (options item) main line.
optionindependentinteger1 when the option line’s quantity is independent of the main item’s quantity.
inventorylocationidintegerInventorylocationid. Id only.
inventorylocationstring(20)The locationcode of the referenced inventorylocations, instead of the id. Send this or inventorylocationid, not both unless they agree.
taxflag2integerWhether the second line tax applies.
taxflag3integerWhether the third line tax applies.
taxflagidintegerTaxflagid. Id only.
taxflag2idintegerTaxflag2id. Id only.
taxflag3idintegerTaxflag3id. Id only.
itemweightnumberstring(6dp)Numeric string, 6 decimal places. Not money - do not apply currency rounding.
qtyorderpriceqtystringQuantity, stored as double, as a string. Stored as double.
pricelevelidintegerPricelevelid. Id only.
price_overrideinteger1 when the price was manually overridden, so repricing leaves it alone.
extended_pricemoneystring(5dp)Stored as decimal(19,5).
worktypeidintegerReference to worktypes, by id. Write either this or worktype.
worktypestring(100)Code for the referenced worktype, instead of the id.
worksubtypeidintegerWorksubtypeid. Id only.
discount_percentnumberstring(2dp)Numeric string, 2 decimal places. Not money - do not apply currency rounding.
orig_priceachmoneystring(6dp)Stored as decimal(19,6).
vendoridintegerReference to vendors, by id. Write either this or vendor.
vendorstring(30)Code for the referenced vendor, instead of the id.
linedatestringDate recorded for the line (service and rental lines).
linetypeintegerLine type: 0 = standard product line, 1 = product-type tax, 2 = delivery charge, 3 = fuel charge, 4 = restock fee, 5 = billed expense.
partialtaxexemptionidintegerPartial tax exemption applied to the line.
partialtaxexemptionstring(32)The exemptname of the referenced taxexempts, instead of the id. Send this or partialtaxexemptionid, not both unless they agree.
taxclassidintegerTaxclassid. Id only.
taxclassstring(100)The name of the referenced taxclasses, instead of the id. Send this or taxclassid, not both unless they agree.
transfrominventorylocationidintegerReference to inventorylocations, by id. Write either this or transfrominventorylocation.
transfrominventorylocationstring(20)The locationcode of the referenced inventorylocations, instead of the id. Send this or transfrominventorylocationid, not both unless they agree.
createpowhenconvertedfrombidbooleanTrue creates a purchase order for the line when the quote converts to an order.
ignoretaxexemptbooleanTrue taxes the line even when the customer is tax exempt.
itempricespecialdetailidintegerItempricespecialdetailid. Id only.
numperiodsnumberstring(6dp)Numeric string, 6 decimal places. Not money - do not apply currency rounding.
periodstring(1)Rental period the line bills by: D = daily, W = weekly, M = monthly. Empty for non-rental lines.
producttypetaxidintegerProducttypetaxid. Id only.
arserviceorder_timeidintegerArserviceorder timeid. Id only.
assetidintegerAssetid. Id only.
assetidlastchangedateread-onlystringWhen the rental asset assigned to the line last changed.
prpaytypeidintegerPrpaytypeid. Id only.
prpaytypemultipliernumberstring(2dp)Numeric string, 2 decimal places. Not money - do not apply currency rounding.
externalidstring(100)Your own key. Scoped to your company.

Endpoints#

POST/orderlines/batch 207400409422

Create many.

Requires scope orders:write.

Parameters
NameInTypeNotes
Body array
FieldTypeDescription
orderidrequiredintegerThe order to add to. Refused once anything on it has shipped.
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.
pricerequiredmoneystringUnit price. Decimal STRING, not a JSON number.
taxablebooleanWhether the line attracts tax.
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_shippedThe order has shipped quantities against it.
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/orderlines/batch' \
  -H 'Authorization: Bearer $NP_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: your-unique-key' \
  -d '[
    {
        "orderid": 104,
        "quantity": "3.000000",
        "price": "125.0000",
        "externalid": "crm-8842"
    }
]'
Response 207
{
    "results": [
        {
            "index": 1,
            "status": 1
        }
    ]
}
GET/orderlines 200403

List order lines.

Requires scope orders:read.

Parameters
NameInTypeNotes
vendoridquerystringRestrict to one vendorid.
itemidquerystringRestrict to one itemid.
inventorylocationidquerystringRestrict to one inventorylocationid.
orderidquerystringRestrict to one orderid.
descriptionquerystringdescription. Partial match, case-insensitive.
modifiedsincequerystringRFC 3339 UTC timestamp. Returns only records changed since then, including cancelled ones - so cancel defaults to any rather than false when this is used. The response carries _meta.synced_through; store it and send it back next time.
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/orderlines' \
  -H 'Authorization: Bearer $NP_TOKEN'
POST/orderlines 201400409422

Create.

Requires scope orders:write.

Parameters
NameInTypeNotes
Body
FieldTypeDescription
orderidrequiredintegerThe order to add to. Refused once anything on it has shipped.
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.
pricerequiredmoneystringUnit price. Decimal STRING, not a JSON number.
taxablebooleanWhether the line attracts tax.
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_shippedThe order has shipped quantities against it.
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/orderlines' \
  -H 'Authorization: Bearer $NP_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: your-unique-key' \
  -d '{
    "orderid": 104,
    "quantity": "3.000000",
    "price": "125.0000",
    "externalid": "crm-8842"
}'
Response 201
{
    "orderid": 104,
    "linenumber": 1,
    "qtyorder": "1.000000",
    "priceach": "125.0000",
    "ordertotal": "125.0000",
    "committed": false
}
GET/orderlines/{id} 200404

Retrieve one record.

Requires scope orders: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/orderlines/104' \
  -H 'Authorization: Bearer $NP_TOKEN'
Response 200
{
    "orderid": 104,
    "itemid": 104,
    "item": "Example item",
    "linenumber": 1,
    "qtyorder": "1.000000",
    "qtyship": "1.000000"
}
PATCH/orderlines/{id} 200400404409422

Update.

Requires scope orders:write.

Parameters
NameInTypeNotes
idrequiredpathintegerThe record id.
Body
FieldTypeDescription
descriptionstring(255)Free text.
qtyorderqtystringQuantity ordered. Re-derives the order total and re-commits stock. Decimal STRING.
priceachmoneystringUnit price. Re-derives the parent total. Decimal STRING.
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_shippedThe line has shipped or been billed.
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/orderlines/104' \
  -H 'Authorization: Bearer $NP_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: your-unique-key' \
  -d '{
    "qtyorder": "3.000000",
    "priceach": "12.5000"
}'
DELETE/orderlines/{id} 200400404409422

Delete.

Remove a line. arorderdetail has no cancel column, so the row is deleted and the remaining lines are renumbered - the same thing the order entry screen does. Answers 200 with the recalculated order, never 204. Refused with line_has_shipped once any quantity has shipped.

Requires scope orders: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_shippedThe line has shipped or been billed.
422unknown_valueNo such record in this company.
curl -X DELETE \
  'https://acme.nolapro.com/!/api/v2/orderlines/104' \
  -H 'Authorization: Bearer $NP_TOKEN'