Assets
Set an asset warranty date
/a/Asset_setWarranty
Replace the warranty date stored on one asset using a required ISO-shaped value.
When to use this endpoint
Use Asset_setWarranty for the warranty-date field on a known asset.
Send the date as YYYY-MM-DD. Unlike asset creation, this setter does not accept spreadsheet date serials or a blank value to clear the field.
Authentication and permissions
The handler requires an authenticated tenant context, established by signed API-key fields or a CRM session. It checks 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 |
|---|---|---|---|
id | Integer string | Yes | Positive server-side asset ID. The handler does not verify that the row exists and does not exclude soft-deleted rows. |
val | Date string | Yes | Exactly four digits, hyphen, two digits, hyphen, two digits. The regular expression checks shape only; it does not validate that the month/day form a real calendar date. |
Example request
$result = FM_api('Asset_setWarranty', [
'id' => '4821',
'val' => '2027-09-24',
]);
Example response
{
"ok": 1
}
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 does not convert to a positive integer. |
{"error":"val must be in YYYY-MM-DD format"} | val is omitted or does not match the required digit-and-hyphen shape. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The endpoint has no no-change shortcut; resubmitting the same date still updates
last_editedand writes an audit entry. - It does not create an
asset_changeshistory row, including when the date changes. - The update has no archived or deleted filter.
- This is a single-record mutation; it provides no list filtering or pagination.
Side effects
- Attempts to update
warrantyandlast_edited, setsedited_uuidtoAsset_setWarranty, invalidates the asset cache, and writes an asset audit entry.
See it in Fieldmotion
CRM1
Edit Warranty on the Assets table, asset edit page, or customer Assets tab and filter Network requests for Asset_setWarranty. CRM1’s date input supplies the ISO-shaped value.
CRM2
No direct production CRM2 call to Asset_setWarranty was found; CRM2 uses its broader update contract.