Assets
Find an asset by book ID
/a/Asset_getByBookID
Find the first non-deleted asset whose stored book ID exactly matches a supplied value.
When to use this endpoint
Use Asset_getByBookID when an integration already has the external book identifier stored in assets.book_id.
Use Asset_get when the server ID or app ID is already known, especially when only a small field set is needed.
Authentication and permissions
The handler requires an authenticated tenant context, established by signed API-key fields or a CRM session. It checks for the tenant table prefix but does not separately require a logged-in user ID.
No page, role, or asset permission is checked.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
book_id | String | Yes | Book ID after trimming surrounding whitespace. A missing, blank, or whitespace-only value is rejected. Matching follows the database column collation and is exact; no wildcard search is performed. |
Example request
$asset = FM_api('Asset_getByBookID', [
'book_id' => 'BOOK-2048',
]);
Example response
{
"id": "4821",
"name": "Compressor 4",
"code": "CMP-004",
"active": "1",
"value": "1250.00",
"meta": "{\"custom\":{}}",
"type_id": "47",
"location_type": "1",
"location_id": "1088",
"owner_id": "1088",
"archived": "0",
"book_id": "BOOK-2048",
"deleted": "0"
}
The endpoint selects *. The representative response is abbreviated: schema-specific columns such as timestamps, encoded metadata, files, contacts, cached job details, and deletion fields are also returned.
If no row matches, the response is the JSON value false, not an error object.
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: book_id"} | book_id is omitted or blank after trimming. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Soft-deleted assets are excluded; inactive and archived assets are included.
- The response preserves database scalar types, so IDs and flags normally appear as strings and JSON columns remain encoded strings.
- There is no partial-field option, search filtering, or pagination.
See it in Fieldmotion
CRM1
No direct production CRM1 call to Asset_getByBookID was found. CRM1’s asset tables normally work from asset IDs and use other list/detail endpoints.
CRM2
No direct production CRM2 call to Asset_getByBookID was found.
Related endpoints
Asset_getretrieves a record by server ID or app ID and supports a field allowlist.Asset_setBookIdchanges the lookup key and applies the tenant uniqueness setting.Asset_newcan assign the book ID during creation.