Stock counts
Physical and cycle count batches, and the lines being counted.
The object#
| Field | Type | Description |
|---|---|---|
| id | integer | NolaPro id. |
| type | string | Cycle counts a subset regularly; physical counts everything. Labels are Invcountbatch_model::$types; stored as an int and never exposed as one. One of cycle, physical. |
| inventorylocationid | integer | The location being counted. |
| invadjustmenttypeid | integer | The adjustment type variance posts through. It carries the GL account, so it decides where a discrepancy lands. |
| genuserid | integer | Who the count is assigned to. |
| assigneddate | string | When it was assigned. |
| accepted | boolean | The counter accepted the assignment. |
| accepteddate | string | When they accepted. |
| complete | boolean | Counting is finished; variance has not necessarily been posted. |
| completedate | string | When counting finished. |
| posted | boolean | Variance has been posted, turning differences into stock adjustments. |
| posteddate | string | When it was posted. |
| noglpost | boolean | Post the stock movement without a GL entry. |
| cancel | boolean | Cancelled counts stay readable. |
| entrydate | string | When the batch was created. |
| lastchangedate | string | Last modification. Drives modifiedsince. |
Endpoints#
Stock count batches.
Physical and cycle count batches - how stock stays honest.
A batch is opened against a location, assigned to someone, counted line by line, and then POSTED, which turns each variance into a stock adjustment through the batch's adjustment type. The read endpoints here expose the batch and its lines; posting is not yet available through the API.
countset on a line is the field to watch: it separates a counted zero from a line nobody has looked at, and a count of 0 means nothing without it.
Requires scope items:read.
| Name | In | Type | Notes |
|---|---|---|---|
| type | query | string | Restrict to one type: cycle or physical. |
| inventorylocationid | query | string | Restrict to one stocking location. |
| genuserid | query | string | Restrict to the user the batch is assigned to. |
| posted | query | string | Whether the batch has been posted to stock. true or false. |
| complete | query | string | Whether counting has finished. A complete batch is not necessarily posted. |
| 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. |
| 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. |
curl \ 'https://acme.nolapro.com/!/api/v2/inventorycounts' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/inventorycounts'); 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/inventorycounts", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/inventorycounts', { 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/inventorycounts"); res.EnsureSuccessStatusCode();
One count batch.
The batch header. Its lines are at /inventorycounts/{id}/lines.
Requires scope items:read.
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | |
| 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. |
| Status | Code | Meaning |
|---|---|---|
| 404 | not_found | No such record in this company. |
curl \ 'https://acme.nolapro.com/!/api/v2/inventorycounts/104' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/inventorycounts/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/inventorycounts/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/inventorycounts/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/inventorycounts/104"); res.EnsureSuccessStatusCode();
{
"type": "cycle",
"inventorylocationid": 2,
"invadjustmenttypeid": 0,
"genuserid": 0
}
What is being counted, and what was found.
One line per item in the batch. count is what was found and countset says whether anyone has looked yet - a zero count and an uncounted line are different facts and the API keeps them apart.
Requires scope items:read.
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The batch id. |
| Status | Code | Meaning |
|---|---|---|
| 422 | unknown_value | No such record in this company. |
curl \ 'https://acme.nolapro.com/!/api/v2/inventorycounts/104/lines' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/inventorycounts/104/lines'); 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/inventorycounts/104/lines", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/inventorycounts/104/lines', { 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/inventorycounts/104/lines"); res.EnsureSuccessStatusCode();