PO lines
Lines on a purchase order. Normally sent nested inside the PO.
The object#
| Field | Type | Description |
|---|---|---|
| idread-only | integer | NolaPro id. |
| invpoid | integer | Invpoid. 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. |
| itemqtyqty | string(6dp) | Quantity, 6 decimal places, as a string. Stored as decimal(6dp). |
| itempricemoney | string(6dp) | Stored as decimal(19,6). |
| detail_description | string(255) | Line description printed on the PO. |
| inv_glacctmoney | string | Stored as double. |
| conversionnumber | string(6dp) | Numeric string, 6 decimal places. Not money - do not apply currency rounding. |
| itemvendorid | integer | Itemvendorid. Id only. |
| 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. |
| itempriceqtyqty | string(5dp) | Quantity, 5 decimal places, as a string. Stored as decimal(5dp). |
| notes | string(500) | Free-form notes on the line. |
| jobid | integer | Jobid. Id only. |
| costcodeid | integer | Cost code. |
| costcode | string(20) | Code for the referenced costcode, instead of the id. |
| glcategoryid | integer | Glcategoryid. Id only. |
| glcategory | string(20) | The code of the referenced glcategories, instead of the id. Send this or glcategoryid, not both unless they agree. |
| taxable | integer | Whether this line is taxed. |
| detailrow | integer | Position of the line on the PO. |
| taxmoney | string(6dp) | Stored as decimal(19,6). |
| reqshipdate | string | Ship date requested from the vendor for this line. |
| accepted | integer | 1 once the line is marked Accepted on the PO screen. |
| arorderdetailid | integer | Arorderdetailid. Id only. |
| donotupdatelastpocost | boolean | True keeps receipts of this line from updating the item’s last PO cost. |
| linenumber | integer | Position of this line on its document, starting at 1. |
| linetype | integer | Line type: 0 = standard product line; other values mark charge lines. |
| assetid | integer | Assetid. Id only. |
| createasset | boolean | True creates a fixed asset from the line when it is received. |
| externalid | string(100) | Your own key. Scoped to your company. |
Endpoints#
POST/purchaseorderlines/batch
207400409422
Create many.
Requires scope purchaseorders:write.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
Body array
| Field | Type | Description |
|---|---|---|
| purchaseorderidrequired | integer | The PO to add to. Refused once it is complete or has receipts. |
| 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. |
| pricemoney | string | Unit price. Defaults to 0. Decimal STRING, not a JSON number. |
| notes | string(500) | Line notes. |
| jobid | integer | Job to cost this to. |
| costcodeid | integer | Cost code. |
| 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_receipts | The purchase order has receipts against it. |
| 409 | po_complete | The purchase order is marked complete. |
| 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/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" } ]'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/purchaseorderlines/batch'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ [ 'purchaseorderid' => 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/purchaseorderlines/batch", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, json=[ { "purchaseorderid": 104, "quantity": "3.000000", "price": "125.0000", "externalid": "crm-8842", }, ], ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/purchaseorderlines/batch', { method: 'POST', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, body: JSON.stringify([ { purchaseorderid: 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 { purchaseorderid = 104, quantity = "3.000000", price = "125.0000", externalid = "crm-8842", }, }; var req = new HttpRequestMessage(HttpMethod.Post, "https://acme.nolapro.com/!/api/v2/purchaseorderlines/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/purchaseorderlines
200403
List po lines.
Requires scope purchaseorders:read.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| itemid | query | string | Restrict to one itemid. |
| jobid | query | string | Restrict to one jobid. |
| invpoid | query | string | Restrict to one invpoid. |
| 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/purchaseorderlines' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/purchaseorderlines'); 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/purchaseorderlines", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/purchaseorderlines', { 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/purchaseorderlines"); res.EnsureSuccessStatusCode();
POST/purchaseorderlines
201400409422
Create.
Requires scope purchaseorders:write.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
Body
| Field | Type | Description |
|---|---|---|
| purchaseorderidrequired | integer | The PO to add to. Refused once it is complete or has receipts. |
| 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. |
| pricemoney | string | Unit price. Defaults to 0. Decimal STRING, not a JSON number. |
| notes | string(500) | Line notes. |
| jobid | integer | Job to cost this to. |
| costcodeid | integer | Cost code. |
| 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_receipts | The purchase order has receipts against it. |
| 409 | po_complete | The purchase order is marked complete. |
| 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/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" }'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/purchaseorderlines'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ 'purchaseorderid' => 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/purchaseorderlines", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, json={ "purchaseorderid": 104, "quantity": "3.000000", "price": "125.0000", "externalid": "crm-8842", }, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/purchaseorderlines', { method: 'POST', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, body: JSON.stringify({ purchaseorderid: 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 { purchaseorderid = 104, quantity = "3.000000", price = "125.0000", externalid = "crm-8842", }; var req = new HttpRequestMessage(HttpMethod.Post, "https://acme.nolapro.com/!/api/v2/purchaseorderlines") { Content = JsonContent.Create(body), }; req.Headers.Add("Idempotency-Key", "your-unique-key"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode();
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
| 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/purchaseorderlines/104' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/purchaseorderlines/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/purchaseorderlines/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/purchaseorderlines/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/purchaseorderlines/104"); res.EnsureSuccessStatusCode();
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
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The record id. |
Body
| Field | Type | Description |
|---|---|---|
| description | string(255) | Free text. |
| itemqtyqty | string | Quantity. Re-derives the PO total. Decimal STRING. |
| itempricemoney | string | Unit price. Re-derives the PO total. Decimal STRING. |
| notes | string(500) | Longer notes. |
| 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_receipts | The purchase order has receipts against it. |
| 409 | po_complete | The purchase order is marked complete. |
| 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/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" }'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/purchaseorderlines/104'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_POSTFIELDS => json_encode([ 'itemqty' => '3.000000', 'itemprice' => '12.5000', ]), ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.patch( "https://acme.nolapro.com/!/api/v2/purchaseorderlines/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, json={ "itemqty": "3.000000", "itemprice": "12.5000", }, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/purchaseorderlines/104', { method: 'PATCH', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, body: JSON.stringify({ itemqty: "3.000000", itemprice: "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 { itemqty = "3.000000", itemprice = "12.5000", }; var req = new HttpRequestMessage(HttpMethod.Patch, "https://acme.nolapro.com/!/api/v2/purchaseorderlines/104") { Content = JsonContent.Create(body), }; req.Headers.Add("Idempotency-Key", "your-unique-key"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode();
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
| 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_receipts | The purchase order has receipts against it. |
| 409 | po_complete | The purchase order is marked complete. |
| 422 | unknown_value | No such record in this company. |
curl -X DELETE \ 'https://acme.nolapro.com/!/api/v2/purchaseorderlines/104' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/purchaseorderlines/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/purchaseorderlines/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/purchaseorderlines/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/purchaseorderlines/104"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode();