Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply

Issue with authentication - Odata Feed to serviceM8

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

1 ACCEPTED SOLUTION
v-saisrao-msft
Community Support
Community Support

Hi @stan_w_gifford,

This issue occurs because Power BI supports only one authentication method per data source, and built-in options like Basic authentication automatically handle the Authorization header. On the other hand, Web.Contents lets you add custom headers for manual authentication. Since ServiceM8 requires both Basic authentication and an API key header, this can create a conflict with Power BI’s authentication model. To resolve this, use Anonymous authentication and manually add both the Authorization and x-api-key headers in Web.Contents, as recommended by Microsoft for header-based authentication scenarios.

Power Query Web Connector - Power Query | Microsoft Learn

Web.Contents - PowerQuery M | Microsoft Learn

Handling authentication for Power Query connectors - Power Query | Microsoft Learn

Tutorial: Integrate Power BI with key phrase extraction - Foundry Tools | Microsoft Learn

 

Thank you.

 

View solution in original post

4 REPLIES 4

Sorry for late reply - we have been on anzac day weekend in aus (Lest we forget)

 

After looking at the very helpfull replies, I have actually found that the key is not needed - just basic auth.

I suspect that this may change in the future however for the moment I am proceeding with everything good.

 

Stan

v-saisrao-msft
Community Support
Community Support

HI @stan_w_gifford,

Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.

 

Thank you.

Murtaza_Ghafoor
Solution Supplier
Solution Supplier

@stan_w_gifford 

Important:

In Data Source Settings  go to Credentials, mark it set it to:

Anonymous

This will work because:

In Power BI, no longer tries to override headers

You will fully control authentication

If this helps,  Mark as Kudos | Mark as Solution| Help Others

v-saisrao-msft
Community Support
Community Support

Hi @stan_w_gifford,

This issue occurs because Power BI supports only one authentication method per data source, and built-in options like Basic authentication automatically handle the Authorization header. On the other hand, Web.Contents lets you add custom headers for manual authentication. Since ServiceM8 requires both Basic authentication and an API key header, this can create a conflict with Power BI’s authentication model. To resolve this, use Anonymous authentication and manually add both the Authorization and x-api-key headers in Web.Contents, as recommended by Microsoft for header-based authentication scenarios.

Power Query Web Connector - Power Query | Microsoft Learn

Web.Contents - PowerQuery M | Microsoft Learn

Handling authentication for Power Query connectors - Power Query | Microsoft Learn

Tutorial: Integrate Power BI with key phrase extraction - Foundry Tools | Microsoft Learn

 

Thank you.

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors