Products API
12 PracBill API endpoints for products. Base URL https://billing.pracbill.com.au/api.
Get a single product category.
GET /{api_key}/category/get/{catid}
Responses
200— Success. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Get all product categories for the department, keyed by catid.
GET /{api_key}/category/getAll
Responses
200— Success. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Get a single product. (The URI is singular `product`; there is no `/products/get/{pid}` route.)
GET /{api_key}/product/get/{pid}
Responses
200— Product retrieved successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Products for a category (excludes deleted products, ordered by title). Page 1. Rows are 20 per page; the server remembers the autotable token per api key (temp file `api-{token}-products.txt`).
GET /{api_key}/products/category/{catid}
Responses
200— Request received successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Products for a category (excludes deleted products, ordered by title). Page 1. Rows are 20 per page; the server remembers the autotable token per api key (temp file `api-{token}-products.txt`).
GET /{api_key}/products/category/{catid}/page
Responses
200— Request received successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Products for a category (excludes deleted products, ordered by title). Rows are 20 per page; the server remembers the autotable token per api key (temp file `api-{token}-products.txt`).
GET /{api_key}/products/category/{catid}/page/{page_number}
Responses
200— Request received successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
List products (page 1). Handler `ProductsGetMyPage`. Excludes deleted products, ordered by title. Rows are 20 per page; the server remembers the autotable token per api key (temp file `api-{token}-products.txt`).
GET /{api_key}/products/get
Responses
200— Request received successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
List products (page 1). Alias of `/products/get`. Rows are 20 per page; the server remembers the autotable token per api key (temp file `api-{token}-products.txt`).
GET /{api_key}/products/get/page
Responses
200— Request received successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
List products for the given page. Note: a second class `productsGetPage` in the same file declares the same URIs but is shadowed by `ProductsGetMyPage` (declared first, equal priority) and is never dispatched. Rows are 20 per page; the server remembers the autotable token per api key (temp file `api-{token}-products.txt`).
GET /{api_key}/products/get/page/{page_number}
Responses
200— Request received successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Get all products (no pagination), keyed by pid. Includes deleted products. When the department has no products returns `success: false`, `description: no products found`.
GET /{api_key}/products/getAll
Responses
200— All products retrieved successfully. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Get stock quantity on hand for a product, grouped by stock location.
GET /{api_key}/stock/quantity/{pid}
Responses
200— Stock quantities retrieved. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.
Remove stock (move out) for a product from a location. Uses HTTP DELETE with an optional JSON body. The request body is read as raw JSON (`explode('=')` + `urldecode` + `json_decode`); because of a `$data_pats` typo in the handler the `data=` form is NOT effectively supported - send the raw JSON document (a body containing a literal '=' is truncated at the first '=').
DELETE /{api_key}/stock/{pid}
Request body
| Field | Type | Description |
|---|---|---|
location | integer | Stock location ID to remove stock from. Defaults to the primary sales location. |
quantity | integer | Quantity to remove. When omitted/0 a single unit is removed. Serialised products remove that many serials. |
Responses
200— Stock removed. Failures (invalid key, validation, not found) are also returned with HTTP 200 and `success: false` + `description`.