Stock items and catalogue maintenance
Save manufacturing details
/a/Stock_setDetails
Save or clear manufacturing identifiers while preserving other stock metadata.
When to use this endpoint
Use this legacy details-dialog save to edit manufacturing identifiers. Supply an empty string to clear a value.
Authentication and permissions
Authenticate with a signed API key or a logged-in CRM session on the account’s routed host. API keys act as their owner; session calls require dispatcher CSRF protection where configured. IDs address the authenticated tenant.
These stock handlers do not add a Stock page-action or CRM2 role check, and the dispatcher has no Stock/Stocks TeamAccess object mapping. CRM2 screen controls are separate from this shared API contract; their roles must not be assumed to apply to CRM1.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive stock catalogue ID. It is not a stock-container row ID, category ID or supplier ID. |
manufacturer | String | No | Supplied string replaces meta.manufacturer. Omitted/null preserves the old value; empty string clears it. |
barcode | String | No | Supplied string replaces meta.barcode. Omitted/null preserves the old value; empty string clears it. |
manufacturer_part_no | String | No | Supplied string replaces meta.manufacturer_part_no. Omitted/null preserves the old value; empty string clears it. |
supplier_part_no | String | No | Supplied string replaces meta.supplier_part_no. Omitted/null preserves the old value; empty string clears it. |
Example request
$result = FM_api('Stock_setDetails', ['id'=>'18', 'barcode'=>'12345']);
Example response
{
"ok": 1
}
Application errors can use HTTP 200. Inspect error/warning fields; database numeric values can be strings unless this handler explicitly converts them.
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: id"} | ID is absent or integer-converts below 1. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Omitted/null manufacturing keys retain their old value; supplied strings replace the key, including an empty string to clear it. Other metadata is preserved. Structured/non-string field values are rejected.
- Requires an existing undeleted item. Changed metadata advances last_edited and edited_uuid=Stock_setDetails and records stock history. No change still acknowledges ok:1.
- Primary changes and stock history use a checked transaction. Failed validation/read/write/commit returns an error and rolls back open changes. Configured events/notices run after commit; a post-commit warning means the save succeeded and must not be repeated blindly.
Side effects
- Checked stock metadata/history/cache writes, then configured Stock_edit events.
See it in Fieldmotion
CRM1
Open Stock in CRM1. The legacy grid is Stock_getDT and its editor/inline actions use legacy Stock routes. Inspect the exact function name in the browser Network panel. Save the manufacturer/barcode details dialog.
CRM2
Open Stocks in CRM2. Stock layouts derive Stock_createData, Stock_updateData and Stock_getLayoutDetails through the shared helpers; the grid calls Stocks_getDataTable. Inspect the exact function name in Network requests. The layout uses mapped meta fields; it does not use this legacy merge dialog.
Related endpoints
Stock_getDetails— Return four stock metadata values as a JSON string inside the API JSON response.Stock_updateData— Update stock fields, category membership and picker values through the full mapped save.