Stock catalog fields and lookups
Read stock location tags
/a/Stock_getLocationTags
Read stock location tags as UI-compatible text, including normalized legacy string lists.
When to use this endpoint
Use to edit stock’s descriptive location tags. These tags do not move inventory or assign a stock container/location owner.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. This handler requires both a user identity and tenant context; it adds no stock-page, finance or administrator permission check.
All queries use the authenticated tenant. API signing and session CSRF checks still apply; see Getting started.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible string | Yes | Stock ID converted with intval; must be at least 1. |
Example request
$tags = FM_api('Stock_getLocationTags', ['id'=>'1042']);
Example response
"Cabinet A\nShelf 2"
Returns newline-separated text. A stored native list of strings is joined with newlines at read time without rewriting metadata.
The CRM1 Stock_getDT and CRM2 Stocks_getDataTable responses also present retained string lists as newline-separated text for their stock editors; these reads do not rewrite stored metadata.
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 missing or integer-converts below 1. |
"" | Missing/deleted stock, malformed/blank meta, or missing/null location_tags; these remain indistinguishable. |
{"error":"invalid stored location tags"} | Stored location_tags is neither text nor a native list containing only strings. |
{"error":"stock catalog read failed"} | Database read fails. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- ID validation precedes login. Requires tenant context; excludes deleted stock but includes archived stock.
- Decodes meta and returns location_tags as text. String values are unchanged; a legacy native string list is joined with newlines. Unsupported stored types return an error. No sorting, trimming or deduplication.
- No paging, search, department or owner restriction is applied. The response is not a DataTables wrapper.
- No direct mobile caller was found in the current app JavaScript or
m/wwwintermediary. The app receives stock throughsyncDownloads, which selects non-deleted stock by edit timestamp; these calls are not the app synchronization protocol.
Side effects
- Read-only; no stock movement, history or sync metadata.
See it in Fieldmotion
CRM1
Click the Stock location/tags cell. CRM1 calls Stock_getLocationTags before opening a textarea marked One tag per line.
CRM2
No direct getter caller was found. CRM2 Stocks reads meta from its table response and splits location_tags on newlines before editing.
Related endpoints
Stock_setLocationTagsstores the value in metadata.