When to use this endpoint

Use PowerBI_getData as the entry point for the legacy Fieldmotion Power BI custom connector. New Power BI integrations should normally use the read-only OData feed instead.

Use module and, where supported, dataset to refresh one table without constructing the larger legacy payload.

Authentication and permissions

This route accepts the raw api_id/api_key pair and calls PowerBI_authenticate; a pre-existing signed API request is not required. The key and tenant user must exist.

The authenticated user is not checked against a page/role permission. The endpoint serialises concurrent exports for the same key with a filesystem lock and releases it on normal completion, configuration errors, and shutdown.

Parameters

ParameterTypeRequiredDescription
api_idInteger-compatibleYesRaw API key ID used by the connector authentication helper.
api_keyStringYesRaw API key value. Send only over HTTPS and avoid request logging.
moduleStringNoOverrides the configured module list for this request. Supported values include areas, assets, all_assets, asset_location_history, contracts, all-contracts, customers, all_customers, form_data, table_data, invoices, invoice_lineitems, jobs, purchase_orders, purchase_order_line_items, quotes, quote_line_items, all_recurrences, all-sors, all-stock, all-users, skills, user_skills, user_clockins, and all.
datasetStringNoReturn only one key for projected modules: assets accept asset_data, asset_custom_data, or asset_table_data; customers accept customer_data or customer_table_data; invoices, purchase orders, and quotes accept their main or *_lineitem_data key. The dataset must match module.

Example request

FM_api('PowerBI_getData', [
	'api_id' => POWER_BI_API_ID,
	'api_key' => POWER_BI_API_KEY,
	'module' => 'customers',
	'dataset' => 'customer_data',
]);

Example response

{
  "customer_data": [
    {"customer_id":"1042","customer_name":"Example Ltd","area_id":"8"}
  ]
}

Without dataset, the object contains the selected module keys plus compatibility placeholders for many unselected tables. The principal keys are areas_data, asset_data, asset_custom_data, asset_table_data, asset_location_history_data, contract_data, customer_data, customer_table_data, form_data, table_data, invoice_data, invoice_lineitem_data, job_data, purchase_order_data, purchase_order_lineitem_data, quote_data, quote_lineitem_data, recurrence_data, sor_data, stock_data, user_data, skills, user_skills, and user_clockins.

Errors and unusual responses

ResponseCondition
{"error":"no API id supplied"} / {"error":"no API key supplied"}A raw credential is missing.
{"error":"invalid credentials"}The raw key pair or referenced user is not valid.
{"error":"invalid parameter: dataset"}dataset is not valid for the requested module.
{"error":"power-bi setting not selected"}The tenant power-bi setting is not a nonempty array, even when module was supplied.
{"error":"power-bi-date-from setting not selected"}The configured start date is not exactly YYYY-MM-DD.
{"error":"power-bi-date-to setting not selected"}The configured end date is not exactly YYYY-MM-DD.

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 tenant power-bi, power-bi-date-from, and power-bi-date-to settings are mandatory. Supplying module replaces the selected module list after that validation and is not checked against the configured selections.
  • Date-bounded modules receive an inclusive start at the configured date and an inclusive end at 23:59:59 on the configured end date. “All” customer/asset variants and master-data modules ignore that range.
  • With no projection, missing datasets are usually represented as [{}]; asset_custom_data uses {}. These placeholders exist for legacy Power Query navigation, not as records.
  • module=all exports date-bounded invoices, jobs, purchase orders, and quotes; related customers/assets; and broad master datasets. It does not include Areas or recurrences. Its legacy quote_lineitem_data key currently repeats quote_data rather than quote line items.
  • The request body is decoded but otherwise ignored. All controls come from request parameters and tenant settings.
  • This endpoint exits after streaming its object and can return legacy application errors with HTTP 200.

See it in Fieldmotion

CRM1

The tenant Power BI settings choose modules and a date range. The legacy custom connector calls this feed to build its navigation tables.

CRM2

CRM2 does not use this feed for its own screens. Tenant Power BI configuration still controls normal unqualified refreshes.

Related endpoints