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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AshishChadda18
New Member

Issue with POST API Call in Power BI

Hello everyone,
I’m trying to call an API from Power BI using Power Query M, but I'm encountering issues retrieving the expected publicToken. Here are the details of my situation:
 
What I’ve Tried:
  1. Constructed the API URL correctly with the master ID.
  2. Used the API key and secret for authentication.
  3. Attempted to extract the publicToken from the response JSON
 
Current Code:
 
let
    MasterID = [master.id],
    apiKey = "1234",
    apiKeySecret = "12345",
    url = "https://a.blazemeter.com/api/v4/masters/" & Text.From(MasterID) & "/public-token?api_key=" & apiKey & "&api_key_secret=" & apiKeySecret,
    response = Web.Contents(url),[
        Content=Text.ToBinary("")
    ])),
    Source = Json.Document(response),
    publicToken = try Source[result][publicToken] otherwise null
in
    publicToken
 
Error Message:
I received the following error:
DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.
Details:
    DataSourceKind=Web
 
6 REPLIES 6
AshishChadda18
New Member

Thank you for the response @lbendlin . I already tried the above approach but getting the below error: 

Error Message: 

DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.
Details: DataSourceKind=Web

yes, you need to clear the permissions for that connection and choose anonymous.  Power Query has a bad habit of caching credentials, including the wrong ones you chose.

Thanks again, the URL is dynamic but will look into this and update if there's any luck 

Anonymous
Not applicable

Hi @AshishChadda18 ,

 

I reviewed posts in forums and I found that you don't seem to have accepted any reply yet, is your problem solved? As lbendlin said, you could change your credential to see if it works.

Steps to 

  1. Go to File/Options and Settings/Data source settings
  2. Select your datasource and click Edit Permissions then Edit Credentials
  3. Select Anonymous and try again 

Similar post:

Solved: Web.Contents with the Content option is only suppo... - Microsoft Fabric Community

Solved: Web.Contents with the Content option is only suppo... - Microsoft Fabric Community

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Unfortunately, none of the solutions worked for us. We weren't able to resolve the POST API request. Additionally, it seems that dynamic API calls only work on the desktop version and not on the service version. As a result, we moved our data to an SQL database and fed it into Power BI. Thanks

lbendlin
Super User
Super User

Please follow the documentation. Use Header, RelativePath and Query parameters. https://learn.microsoft.com/en-us/powerquery-m/web-contents#example-1

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors