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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
DanT1994
Helper I
Helper I

Connect to Web API with custom header

Hi,

 

I'm getting the following error when trying to connect a web API.

Using an online API testing tool, my URL and custom header looks like this:

DanT1994_0-1697019061441.png

 

So, I'm maybe simplifying this too much, but in PowerBI i'm entering it like this:

DanT1994_1-1697019105698.png



And it's throwing up the following error:

DanT1994_2-1697019135498.png



How can I get around this?

Thanks in advance
Dan



1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @DanT1994,

Perhaps you can try opt use following code to use web connector getting data with apikey in anonymous mode:

let
    url="xxx.xxxxxx.com",
    apiKey = "key",
    headers = [

        #"CLICDATA-API-KEY" = apiKey,
        #"Content-Type" = "application/json"
    ],
    path="/api/xxx/xxx",
    request = Web.Contents(url, [ Headers = headers, RelativePath= path])
in
    request

Using The RelativePath And Query Options With Web contents 

Regards,

Xiaoxin Sheng

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

HI @DanT1994,

Perhaps you can try opt use following code to use web connector getting data with apikey in anonymous mode:

let
    url="xxx.xxxxxx.com",
    apiKey = "key",
    headers = [

        #"CLICDATA-API-KEY" = apiKey,
        #"Content-Type" = "application/json"
    ],
    path="/api/xxx/xxx",
    request = Web.Contents(url, [ Headers = headers, RelativePath= path])
in
    request

Using The RelativePath And Query Options With Web contents 

Regards,

Xiaoxin Sheng

lbendlin
Super User
Super User

yes, you have to cancel out of that dialog first.

Unfortunately if I do that, the data source wont be there so the 'edit permissions'/'clear permissions' boxes are greyed out.  There's no way of clearing the permissions at the same time as adding the data source...

Now would be as good as any time to start over, with a new PBIX file...

lbendlin
Super User
Super User

As it says in the error message - you need to include the authentication either in the header or in the body.

Thanks for the reply, please could you expand/advise how I'd do that?  I thought I had included my authentication key in the header (screenshot in original post).

Thanks

Go to Data Source settings, clear permissions for the API URL, and on next try use anonymous auth.

It won't allow me to save the source, because of the above error, so I'm unable to go into data source settings and clear permissions...

Thanks
Dan

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.