When to use this endpoint

Use Vehicle_updateData for CRM2 edit layouts, custom vehicle fields, and integrations that need partial mapped updates. It is safer than the all-fields CRM1 Vehicle_update contract.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but performs no additional Vehicles-page, create, edit, delete, or role-permission check.

All reads and writes use the authenticated tenant’s tables. CRM1 and CRM2 may hide controls through client-side permissions; these routes do not repeat those UI checks.

Parameters

ParameterTypeRequiredDescription
idInteger-compatible or native arrayYesNumeric vehicle ID. The shared updater accepts a native array for bulk changes, but discards individual warnings and errors, so use a scalar ID when the outcome must be checked.
uuIDStringNoVehicle UUID. Creation generates a random 32-character hexadecimal value when omitted. The unusual capitalisation is the exact mapped field name.
nameStringNoRegistration value used by CRM2 layouts. It maps to the same database column as reg; creation requires a nonempty name even when reg is also supplied.
regStringNoLegacy alias for the registration column. If both name and reg are supplied, the later reg mapping wins. Duplicate and blank values are not rejected on update.
descriptionStringNoFree-text vehicle description.
costPerDistanceNumeric-compatibleNoInternal cost per mile or kilometre, converted with floatval(). The layout declares a minimum of zero, but the shared server-side converter does not enforce that layout minimum.
pricePerDistanceNumeric-compatibleNoCustomer charge per mile or kilometre, converted with floatval(). Negative values are accepted despite the layout’s zero-minimum metadata.
locationStringNoLegacy free-text location stored directly on the vehicle.
lastEditedDatetime stringNoMapped edit time. Ordinary mapped writes set last_edited to the current server datetime when a change is made.
editedUUIDStringNoLegacy edit-source marker. Mapped updates do not populate it automatically.
metaJSON-compatible valueNoComplete vehicle metadata value. Arrays are JSON-encoded for storage; a blank string stores SQL NULL.
cDateUnix timestamp or date stringNoCreation time stored as a Unix timestamp. Creation defaults to the current server time; mapped reads format it as a datetime.
customValuesObject or associative arrayNoCustom vehicle values stored below meta.custom_values. Supplying this field replaces that nested object.

Example request

$result = FM_api('Vehicle_updateData', [
	'id' => '30124',
	'description' => 'Primary service van',
	'customValues' => [
		'cost-centre' => 'Service',
	],
]);

Example response

{"ok":1}

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":"missing or invalid parameter: id"}id is absent.
{"error":"missing or invalid parameter: name"}A supplied required registration mapping is empty. The same required check is not applied when the field is omitted.
{"warning":"no updated fields."}The request contains no recognised mapped field after removing id.
{"warning":"No data."}No vehicle matches the scalar numeric ID.
{"warning":"No Change."}All supplied mapped values compare equal to the stored values.

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

Behaviour and edge cases

  • UUIDs are not accepted as identifiers here: id is integer-converted, so a UUID becomes 0.
  • Only supplied recognised fields are changed. Unknown request fields are ignored and can lead to the no-updated-fields warning.
  • A native ID array applies the same change to each numeric ID but always returns {"ok":1} after the loop, discarding individual errors and warnings.
  • name and reg share the registration column. Supplying both makes reg the final mapped value.

Side effects

  • Changed rows receive the current last_edited datetime, invalidate the vehicle cache, and generate Core history for each changed mapped or custom field.
  • edited_uuid is not automatically changed by this route.

See it in Fieldmotion

CRM1

No direct CRM1 caller was found; CRM1 uses Vehicle_update and individual setter routes.

CRM2

Open Stock → Vehicles in CRM2 and filter browser developer tools for the exact function name. Edit a vehicle or save its Vehicle Main form; the shared display/layout widgets derive Vehicle_updateData from the vehicle mapping.

Related endpoints