When to use this endpoint

Use only when maintaining allocation data itself. Changing qty here is not a Stock_transaction and does not update warehouse, stock inventories or stock movement history.

Authentication and permissions

Authenticate with a signed API key or a logged-in CRM session on the account’s routed host. Signed requests act as the key owner. Session requests must include the dispatcher CSRF value when configured. All record identifiers belong to the authenticated tenant.

The dispatcher and these handlers do not impose an additional CRM2 Stock role or Stock TeamAccess record scope. CRM2 screen permissions are separate controls and must not be assumed to apply to CRM1. These routes do not become public because an individual legacy handler checks only the tenant context.

Parameters

ParameterTypeRequiredDescription
idInteger-compatible or ID listYesSaved allocation row ID(s), not stock or owner IDs. Native, JSON-encoded and comma-separated ID lists update in one checked transaction. Empty lists are rejected.
Mapped valuesScalars/native JSON valuesAt least one meaningful changeWritable values: qty,amtTrigger,inventoryID,meta,metaInventory. Omitted/null values preserve existing fields; zero is a real quantity. Owner/stock identity is rejected; lifecycle display fields and authentication/transport controls are ignored.

Example request

$result = FM_api('StockContainer_updateData', ['id'=>'2081','qty'=>'2']);

Example response

{"ok":1}

Examples show one representative result; database numeric scalars can be JSON strings. Application errors can use HTTP 200: inspect error and warning in the decoded response.

Errors and unusual responses

ResponseCondition
{"error":"not logged in"}No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs.
{"error":"Unable to find stock container"}One or more selected allocation rows are absent.
{"error":"allocation identity is not editable"}Full save contains a protected stock/owner field.
{"error":"missing or invalid field"}Inline field is not in the write allowlist.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Checks every selected allocation and its active catalogue stock inside one checked transaction. Quantity edits retain decimal values; nonnumeric/nonfinite input is rejected. These remain data corrections and do not balance warehouse or stock inventory.
  • Only quantity,threshold and inventory metadata are editable. IDs and owner/stock relationships cannot be reassigned through these routes. Full-save display timestamps/transport metadata are ignored; inline unsupported field names are rejected.
  • Positive inventory references must be active and belong to the allocation’s stock. Structured batch quantities must be finite,nonnegative and fit the resulting allocation quantity. Explicit zero inventoryID means unbatched; supplied metadata replaces that metadata value rather than merging arbitrary keys.
  • All bulk targets and checked audit writes commit together. Any failed target/read/write/audit/commit rolls back the entire save. Empty or malformed ID selections return controlled errors; unchanged valid values acknowledge ok:1.
  • A fresh read is required to verify a data correction. Missing targets now return Unable to find stock container rather than a success-like warning.

Side effects

  • Writes changed allocation columns and server last_edited, invalidates stock_container cache and records checked allocation audit evidence. Does not update warehouse/batch balances, owner timestamps or fire Stock_edit.

See it in Fieldmotion

CRM1

No direct CRM1 caller was found in the source search. CRM1 uses its legacy Stock grid and stockContainerEdit allocation editor instead.

CRM2

No direct CRM2 quantity-edit caller was found for this route. User/Vehicle stock tables are read-only except for the dedicated threshold action; movement controls use Stock_transaction. Tests and shared helpers use raw allocation updates for metadata.

Related endpoints