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#
| Field | Type | Description |
|---|---|---|
| idread-only | integer | NolaPro id. |
| orderid | integer | Orderid. Id only. |
| itemid | integer | Reference to items, by id. Write either this or item. |
| item | string(255) | The sku of the referenced items, instead of the id. Send this or itemid, not both unless they agree. |
| linenumber | integer | Position of this line on its document, starting at 1. |
| qtyorderqty | string(6dp) | Quantity, 6 decimal places, as a string. Stored as decimal(6dp). |
| qtyshipqty | string(6dp) | Quantity, 6 decimal places, as a string. Stored as decimal(6dp). |
| qtybillqty | string(6dp) | Quantity, 6 decimal places, as a string. Stored as decimal(6dp). |
| glaccountid | integer | Reference to glaccounts, by id. Write either this or glaccount. |
| glaccount | string(20) | Code for the referenced glaccount, instead of the id. |
| taxflag | integer | Whether the first line tax applies. NolaPro carries up to three taxes per line. |
| costeachmoney | string(6dp) | Stored as decimal(19,6). |
| priceachmoney | string(6dp) | Stored as decimal(19,6). |
| entrydate | string | When the record was created. |
| lastchangedateread-only | string | Last modification. Drives modifiedsince. |
| products_taxmoney | string(4dp) | Stored as decimal(7,4). |
| description | string(255) | Line description printed on the order. |
| saleunitperpriceunitnumber | string(6dp) | Numeric string, 6 decimal places. Not money - do not apply currency rounding. |
| costglaccountid | integer | Reference to glaccounts, by id. Write either this or costglaccount. |
| costglaccount | string(20) | The name of the referenced glaccounts, instead of the id. Send this or costglaccountid, not both unless they agree. |
| purchaseunitid | integer | Unit the line is purchased in, from unitnames. |
| purchaseunit | string(50) | The unitname of the referenced unitnames, instead of the id. Send this or purchaseunitid, not both unless they agree. |
| priceunitid | integer | Unit the line is priced in, from unitnames. |
| priceunit | string(50) | The unitname of the referenced unitnames, instead of the id. Send this or priceunitid, not both unless they agree. |
| main_arorderdetailid | integer | Main arorderdetailid. Id only. |
| itemoptiongroupid | integer | Itemoptiongroupid. Id only. |
| itemoptionid | integer | Itemoptionid. Id only. |
| multioption | integer | 1 when the line is an option row belonging to a multi-option (options item) main line. |
| optionindependent | integer | 1 when the option line’s quantity is independent of the main item’s quantity. |
| inventorylocationid | integer | Inventorylocationid. Id only. |
| inventorylocation | string(20) | The locationcode of the referenced inventorylocations, instead of the id. Send this or inventorylocationid, not both unless they agree. |
| taxflag2 | integer | Whether the second line tax applies. |
| taxflag3 | integer | Whether the third line tax applies. |
| taxflagid | integer | Taxflagid. Id only. |
| taxflag2id | integer | Taxflag2id. Id only. |
| taxflag3id | integer | Taxflag3id. Id only. |
| itemweightnumber | string(6dp) | Numeric string, 6 decimal places. Not money - do not apply currency rounding. |
| qtyorderpriceqty | string | Quantity, stored as double, as a string. Stored as double. |
| pricelevelid | integer | Pricelevelid. Id only. |
| price_override | integer | 1 when the price was manually overridden, so repricing leaves it alone. |
| extended_pricemoney | string(5dp) | Stored as decimal(19,5). |
| worktypeid | integer | Reference to worktypes, by id. Write either this or worktype. |
| worktype | string(100) | Code for the referenced worktype, instead of the id. |
| worksubtypeid | integer | Worksubtypeid. Id only. |
| discount_percentnumber | string(2dp) | Numeric string, 2 decimal places. Not money - do not apply currency rounding. |
| orig_priceachmoney | string(6dp) | Stored as decimal(19,6). |
| vendorid | integer | Reference to vendors, by id. Write either this or vendor. |
| vendor | string(30) | Code for the referenced vendor, instead of the id. |
| linedate | string | Date recorded for the line (service and rental lines). |
| linetype | integer | Line type: 0 = standard product line, 1 = product-type tax, 2 = delivery charge, 3 = fuel charge, 4 = restock fee, 5 = billed expense. |
| partialtaxexemptionid | integer | Partial tax exemption applied to the line. |
| partialtaxexemption | string(32) | The exemptname of the referenced taxexempts, instead of the id. Send this or partialtaxexemptionid, not both unless they agree. |
| taxclassid | integer | Taxclassid. Id only. |
| taxclass | string(100) | The name of the referenced taxclasses, instead of the id. Send this or taxclassid, not both unless they agree. |
| transfrominventorylocationid | integer | Reference to inventorylocations, by id. Write either this or transfrominventorylocation. |
| transfrominventorylocation | string(20) | The locationcode of the referenced inventorylocations, instead of the id. Send this or transfrominventorylocationid, not both unless they agree. |
| createpowhenconvertedfrombid | boolean | True creates a purchase order for the line when the quote converts to an order. |
| ignoretaxexempt | boolean | True taxes the line even when the customer is tax exempt. |
| itempricespecialdetailid | integer | Itempricespecialdetailid. Id only. |
| numperiodsnumber | string(6dp) | Numeric string, 6 decimal places. Not money - do not apply currency rounding. |
| period | string(1) | Rental period the line bills by: D = daily, W = weekly, M = monthly. Empty for non-rental lines. |
| producttypetaxid | integer | Producttypetaxid. Id only. |
| arserviceorder_timeid | integer | Arserviceorder timeid. Id only. |
| assetid | integer | Assetid. Id only. |
| assetidlastchangedateread-only | string | When the rental asset assigned to the line last changed. |
| prpaytypeid | integer | Prpaytypeid. Id only. |
| prpaytypemultipliernumber | string(2dp) | Numeric string, 2 decimal places. Not money - do not apply currency rounding. |
| externalid | string(100) | Your own key. Scoped to your company. |
Endpoints#
POST/orderlines/batch
207400409422
Create many.
Requires scope orders:write.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
Body array
| Field | Type | Description |
|---|---|---|
| orderidrequired | integer | The order to add to. Refused once anything on it has shipped. |
| itemid | integer | Stock item. Omit for a non-stock line and send a description. |
| description | string(255) | Line text. Defaults to the item description. |
| quantityrequiredqty | string | How many. Decimal STRING, up to 6 places. |
| pricerequiredmoney | string | Unit price. Decimal STRING, not a JSON number. |
| taxable | boolean | Whether the line attracts tax. |
| externalid | string(100) | Your own identifier for this record. Stored verbatim and returned on reads; GET /<resource>?externalid=... finds it again. |
When it fails
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The request was malformed. |
| 409 | line_has_shipped | The order has shipped quantities against it. |
| 422 | rule_violation | NolaPro refused the document. message carries its reason. |
| 422 | unknown_value | A 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" } ]'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/orderlines/batch'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ [ 'orderid' => 104, 'quantity' => '3.000000', 'price' => '125.0000', 'externalid' => 'crm-8842', ], ]), ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.post( "https://acme.nolapro.com/!/api/v2/orderlines/batch", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, json=[ { "orderid": 104, "quantity": "3.000000", "price": "125.0000", "externalid": "crm-8842", }, ], ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/orderlines/batch', { method: 'POST', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, body: JSON.stringify([ { orderid: 104, quantity: "3.000000", price: "125.0000", externalid: "crm-8842", }, ]), } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var body = new[] { new { orderid = 104, quantity = "3.000000", price = "125.0000", externalid = "crm-8842", }, }; var req = new HttpRequestMessage(HttpMethod.Post, "https://acme.nolapro.com/!/api/v2/orderlines/batch") { Content = JsonContent.Create(body), }; req.Headers.Add("Idempotency-Key", "your-unique-key"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode();
Response 207
{
"results": [
{
"index": 1,
"status": 1
}
]
}
GET/orderlines
200403
List order lines.
Requires scope orders:read.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| vendorid | query | string | Restrict to one vendorid. |
| itemid | query | string | Restrict to one itemid. |
| inventorylocationid | query | string | Restrict to one inventorylocationid. |
| orderid | query | string | Restrict to one orderid. |
| description | query | string | description. Partial match, case-insensitive. |
| modifiedsince | query | string | RFC 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. |
| externalid | query | string | Exact match on your own key. |
| include | query | string | Comma-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
| Status | Code | Meaning |
|---|---|---|
| 403 | insufficient_scope | Token lacks read scope. |
curl \ 'https://acme.nolapro.com/!/api/v2/orderlines' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/orderlines'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/orderlines", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/orderlines', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/orderlines"); res.EnsureSuccessStatusCode();
POST/orderlines
201400409422
Create.
Requires scope orders:write.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
Body
| Field | Type | Description |
|---|---|---|
| orderidrequired | integer | The order to add to. Refused once anything on it has shipped. |
| itemid | integer | Stock item. Omit for a non-stock line and send a description. |
| description | string(255) | Line text. Defaults to the item description. |
| quantityrequiredqty | string | How many. Decimal STRING, up to 6 places. |
| pricerequiredmoney | string | Unit price. Decimal STRING, not a JSON number. |
| taxable | boolean | Whether the line attracts tax. |
| externalid | string(100) | Your own identifier for this record. Stored verbatim and returned on reads; GET /<resource>?externalid=... finds it again. |
When it fails
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A required field was missing. |
| 409 | line_has_shipped | The order has shipped quantities against it. |
| 422 | rule_violation | NolaPro refused the document. message carries its reason. |
| 422 | unknown_value | A 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" }'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/orderlines'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ 'orderid' => 104, 'quantity' => '3.000000', 'price' => '125.0000', 'externalid' => 'crm-8842', ]), ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.post( "https://acme.nolapro.com/!/api/v2/orderlines", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, json={ "orderid": 104, "quantity": "3.000000", "price": "125.0000", "externalid": "crm-8842", }, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/orderlines', { method: 'POST', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, body: JSON.stringify({ orderid: 104, quantity: "3.000000", price: "125.0000", externalid: "crm-8842", }), } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var body = new { orderid = 104, quantity = "3.000000", price = "125.0000", externalid = "crm-8842", }; var req = new HttpRequestMessage(HttpMethod.Post, "https://acme.nolapro.com/!/api/v2/orderlines") { Content = JsonContent.Create(body), }; req.Headers.Add("Idempotency-Key", "your-unique-key"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode();
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
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The record id. |
| include | query | string | Comma-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
| Status | Code | Meaning |
|---|---|---|
| 404 | not_found | No record with that id. |
curl \ 'https://acme.nolapro.com/!/api/v2/orderlines/104' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/orderlines/104'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/orderlines/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/orderlines/104', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/orderlines/104"); res.EnsureSuccessStatusCode();
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
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The record id. |
Body
| Field | Type | Description |
|---|---|---|
| description | string(255) | Free text. |
| qtyorderqty | string | Quantity ordered. Re-derives the order total and re-commits stock. Decimal STRING. |
| priceachmoney | string | Unit price. Re-derives the parent total. Decimal STRING. |
| externalid | string(100) | Your own identifier for this record. |
When it fails
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The request was malformed. |
| 404 | not_found | No such record, or it belongs to another company. |
| 409 | line_has_shipped | The line has shipped or been billed. |
| 409 | stale_record | If-Match did not match; someone else changed it first. |
| 422 | rule_violation | NolaPro 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" }'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/orderlines/104'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_POSTFIELDS => json_encode([ 'qtyorder' => '3.000000', 'priceach' => '12.5000', ]), ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.patch( "https://acme.nolapro.com/!/api/v2/orderlines/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, json={ "qtyorder": "3.000000", "priceach": "12.5000", }, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/orderlines/104', { method: 'PATCH', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, body: JSON.stringify({ qtyorder: "3.000000", priceach: "12.5000", }), } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var body = new { qtyorder = "3.000000", priceach = "12.5000", }; var req = new HttpRequestMessage(HttpMethod.Patch, "https://acme.nolapro.com/!/api/v2/orderlines/104") { Content = JsonContent.Create(body), }; req.Headers.Add("Idempotency-Key", "your-unique-key"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode();
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
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The record id. |
When it fails
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The request was malformed. |
| 404 | not_found | No such record, or it belongs to another company. |
| 409 | cannot_cancel | Something already depends on this document - a payment, a shipment, an invoice. |
| 409 | line_has_shipped | The line has shipped or been billed. |
| 422 | unknown_value | No such record in this company. |
curl -X DELETE \ 'https://acme.nolapro.com/!/api/v2/orderlines/104' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/orderlines/104'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'DELETE', ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.delete( "https://acme.nolapro.com/!/api/v2/orderlines/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/orderlines/104', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var req = new HttpRequestMessage(HttpMethod.Delete, "https://acme.nolapro.com/!/api/v2/orderlines/104"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode();