When to use this endpoint

Use Asset_getLocation for maps, distance checks, and current-whereabouts summaries that start with one asset ID.

This endpoint resolves only the immediate reference. Use Asset_getAddress when nested-asset traversal, owner fallback, or a historical address is required.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive server-side asset ID. App IDs are not accepted.

Example request

$location = FM_api('Asset_getLocation', [
	'id' => '4821',
]);

Example response

{
  "location_type": "1",
  "location_id": "1088",
  "name": "Example Engineering",
  "latitude": "53.3498",
  "longitude": "-6.2603",
  "street_address1": "1 Example Street",
  "street_address2": "",
  "town": "Dublin",
  "county": "Dublin",
  "postcode": "D02 XY12",
  "country": "IRL",
  "city": "Dublin",
  "state": "",
  "location_type_name": "Customer"
}

The common base is location_type, location_id, location_type_name, and name. Address and coordinate keys appear only after a matching nonzero location is resolved.

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 or does not convert to a positive integer.
{"error":"asset does not exist"}The asset is missing or soft-deleted.

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

Behaviour and edge cases

  • Location type 0 is labelled Location and returns the location name plus lat/lng as latitude/longitude; all postal-address keys are blank strings.
  • Location type 1 is labelled Customer and returns the customer’s coordinates and address fields. The customer lookup does not filter deleted rows.
  • Location type 2 is labelled Asset, returns only the referenced non-deleted asset’s name, and fills coordinates/address keys with blank strings. It does not follow that asset to its own location.
  • A type of -1 has a blank label. Other out-of-range stored types are not safely normalized by this legacy handler.
  • A zero location ID or a missing referenced row leaves name blank and omits coordinate/address keys.
  • Inactive and archived assets are included. This is a single-record read with no filtering or pagination.

See it in Fieldmotion

CRM1

Open Asset Location History, the Jobs Map, or a time-clock distance view for an asset-linked job and filter Network requests for Asset_getLocation. These callers consume the returned name or coordinates.

CRM2

Open a time-clock view that checks distance for an asset-linked job and filter Network requests for Asset_getLocation. CRM2 uses the same coordinate response.

Related endpoints

  • Asset_getAddress recursively resolves an address and supports a historical timestamp.
  • Asset_get returns the raw location_type and location_id.
  • Asset_getOwner resolves the separate owner relationship.