Forum Discussion
AshishChadda18
1 year agoNew 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:
- Constructed the API URL correctly with the master ID.
- Used the API key and secret for authentication.
- 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
- lbendlinSuper User
Please follow the documentation. Use Header, RelativePath and Query parameters. https://learn.microsoft.com/en-us/powerquery-m/web-contents#example-1
- AshishChadda18New 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- lbendlinSuper User
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.
- AshishChadda18New Member
Thanks again, the URL is dynamic but will look into this and update if there's any luck