When to use this endpoint

Resolve the current customer or asset location for route-planning and map consumers.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. These calls use the authenticated account’s data; the handler has no additional job-page, department, assignee or client-admin permission check unless stated below.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesJob ID, converted with intval; the result must be positive. This selects a physical job ID, not an app ID or job reference.
rNative object/arrayLegacy internal controlWhen present, bypasses job lookup and ID validation and supplies customer_id/customer_type directly. Internal travel calculations pass a loaded row. Do not use this as a normal integration input.

Example request

$result = FM_api('Job_getLocation', ['id' => '1042']);

Example response

{"latitude":"54.5973","longitude":"-5.9301","name":"Northwind Service Centre"}

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"}No r is supplied and id is absent/nonpositive.
{"error":"job does not exist"}The persisted active job lookup fails.
{"error":"unknown customer type"}The row’s customer_type is neither 0 nor 1.
{"error":"customer does not have lat/lon coordinates set"}A direct customer has a zero coordinate; other customer/asset errors propagate.

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 handler checks DBP; normal API dispatch supplies authenticated tenant context. With no r override, it selects an active job.
  • customer_type=0 delegates to Customer_getLocation: latitude, longitude and name, rejecting either zero coordinate and not filtering deleted customers.
  • customer_type=1 delegates to Asset_getLocation. The shape includes location_type/location_id/location_type_name/name and conditional address/coordinate fields. Active assets/work areas are required; customer locations are not active-filtered.
  • An asset located with another asset gets that asset’s name but blank coordinates/address rather than recursive resolution. Unresolved locations can return an empty name without coordinates. This differs from Job_getAddress’s owner fallback and from historic snapshot lookup.
  • No geocoding, cache write, pagination or address repair occurs.

See it in Fieldmotion

CRM1

No direct CRM1 network caller was found. Job_calculateTravel internally calls Job_getLocation with loaded current/previous job rows; inspect that parent request when investigating travel location.

CRM2

No direct CRM2 caller was found in the reviewed source. For batched job fields, see Jobs_getById.

Related endpoints