I am in the process of putting a dashboard together in PowerBI - the data is sourced from both ServiceM8 and Buz.
The BUZ side is working fine.
The serviceM8 is not ![]()
I have successfully got data back from serviceM8 using power automate. ServiceM8 requires an application key x-api-key and basic authentication. Like I say this works perfectly in power automate.
In PBI I have made a blank query and using advanced editor put the following code in;
let
// Replace with your actual token
access_token = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,
// API endpoint example: Get all jobs
Source = Json.Document(
Web.Contents(
“https://api.servicem8.com/api_1.0/job.json”,
[
Headers = [
#“x-Api-Key” = access_token,
Accept = “application/json”
]
]
)
),
// Convert JSON to table
ToTable = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Expanded = Table.ExpandRecordColumn(ToTable, “Column1”)
in
Expanded
Like I say, I have to use basic authentication however when I run the query it chucks a wobbly saying "‘x-Api-Key’ header is only supported when connecting anonymously. "
If I change the authentication to anonymous, the query fails (Authentication error).
In my mind I have a workaround - which may or may not work - write a small power automate and use that to retrieve the data from serviceM8 - however I would prefer to go directly.
Any advice, thoughts, special prayers you can offer me?
Stan