Price bands and stock pricing
Page the legacy price-band finance table
/a/PriceBands_getDT
Return the legacy DataTables wrapper with positional price-band rows.
When to use this endpoint
Use for the CRM1 finance list. Its array-row schema differs from the mapped CRM2 table.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session; all normal calls use that tenant. These handlers do not enforce an additional role or finance-page permission.
Use strings for signed numeric values, including values inside native arrays. Only JSON-encode parameters explicitly described as JSON text; see Getting started.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
start | Integer-compatible scalar | No | Defaults to 0; negative values are rejected. |
length | Positive integer-compatible scalar | Yes | Must be at least 1; omitted/zero/negative values, including -1, are invalid. No upper page-size limit. |
draw | Integer-compatible scalar | Yes | Must be present; returned as an integer. |
order[0][column] / order[0][dir] | Native nested array values | Yes | Column 0=id, 1=name, 2=order_num; any other column falls back to order_num. Only exact desc selects descending; every other supplied direction becomes asc. |
name / search[value] | String | No | Truthy values produce separate name contains-LIKE filters, combined with AND. Blank and "0" are ignored. SQL % and _ wildcard behavior is retained. |
Example request
$table = FM_api('PriceBands_getDT', ['start'=>'0', 'length'=>'20', 'draw'=>'1', 'order'=>[['column'=>'2', 'dir'=>'asc']], 'search'=>['value'=>'Trade']]);
Example response
{"draw":1,"recordsTotal":"8","recordsFiltered":"1","data":[["1042","Trade","2","1","0.9",0]]}
Rows are [id, name, order_num, is_relative, relative_multiple, 0]. The last numeric zero is a UI placeholder. Database values and counts remain strings; draw is an integer.
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid parameter: start"} | Negative start. |
{"error":"missing or invalid parameter: length"} | Missing or nonpositive length. |
{"error":"missing or invalid parameter: [order][0][dir]"} | Direction absent. |
{"error":"missing or invalid parameter: [order][0][column]"} | Column absent. |
{"error":"missing or invalid parameter: draw"} | draw absent. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Counts cover all bands and bands satisfying both supplied name filters, respectively; the page is limited by offset and length. No stable tie-breaker is added.
- No field projection, customer grouping, pricing calculation or finance-feature enforcement. There is no soft-delete filter on this table.
- A failed row query is not converted into a clean documented empty result; do not treat malformed output as an empty successful page.
- The mobile app has no direct caller for this endpoint in the searched JavaScript or
m/wwwintermediary. It downloads price bands throughsyncDownloadsinto its localpriceBandstable.
Side effects
- Read-only; no history, timestamp update, pricing recalculation or cache invalidation.
See it in Fieldmotion
CRM1
Open Settings → Finance → Price Bands. Loading, paging and sorting the table sends PriceBands_getDT. The screen uses order_num initially and disables its visible global search box.
CRM2
No direct CRM2 caller was found. The same finance page uses PriceBands_getDataTable and object rows.
Related endpoints
PriceBands_getDataTableprovides mapped object rows with different defaults and sorting controls.PriceBands_listreturns an unpaged dropdown projection.