Forum Discussion
How to refresh web Api when it has Header and Key values in the sources (web Link)
Hi All,
I have below content as my source:
Source =
Json.Document(
Web.Contents(
"https://abcd.azurewebsites.net/api/CompatAPI/GetVSOItemsByQueryId?queryId=abcd-efgh-ijh",[Headers=[key="abcdefgh12345678"]])),
and i have checked the link "Chris Webb's BI Blog: Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code Chris Webb's BI Blog (crossjoin.co.uk)"
but it does not provide any conditions related to my request which has queriId and Header with Key.
Can anyone provide any lead on how to change my source to make it error free to schedule refresh.
Regards
Santosh Kumar P
Issue :
Source =Json.Document( Web.Contents( "https://abcd.azurewebsites.net/api/CompatAPI/GetVSOItemsByQueryId?queryId=abcd-efgh-ijh",[Headers=[key="abcdefgh12345678"]]))
i have went through few videos in the youtube and noticed that for all web API contents everyone has provided query links in BASIC mode where as i have provided query in Advanced mode.
so, i have modified my query to make is consume data with BASIC mode only.
previous steps i followed is1. go to advance mode
2. provide query string in URl
3. key in Header
Current way:1.append query in Basic mode only as below:
Source =Json.Document( Web.Contents(
"https://abcd.azurewebsites.net/api/CompatAPI/GetVSOItemsByQueryId?queryId=abcd-efgh-ijh&key=abcdefgh12345678"))
then after i went to Settings Data set and Edit Credentials,choose Anonymous and Save.
Then my issue got resolved.
3 Replies
- amitchandak
Super User
SantoshKumar , Based on what I got from the issues and what I found. The syntax I got is
Web.Contents("https://contoso.com/api/customers/get", [ApiKeyName="api_key"])
at https://docs.microsoft.com/en-us/powerquery-m/web-contents
Suggested at
https://community.powerbi.com/t5/Power-Query/Web-API-Key-Authentication/td-p/2389219
Also check
- SantoshKumar
Microsoft Employee
amitchandak the information which you have provided is regarding how to provide key value to Web API.
here i have already provided those things and my data is flowing as expected.
my problem here is that "with the format which appear, i am not able to schedule refresh". i went through few links and found that it should be changed certain format (mentioned in my query) but those links does not deals with "Web Content with Advanced option data".
- SantoshKumar
Microsoft Employee
Issue :
Source =Json.Document( Web.Contents( "https://abcd.azurewebsites.net/api/CompatAPI/GetVSOItemsByQueryId?queryId=abcd-efgh-ijh",[Headers=[key="abcdefgh12345678"]]))
i have went through few videos in the youtube and noticed that for all web API contents everyone has provided query links in BASIC mode where as i have provided query in Advanced mode.
so, i have modified my query to make is consume data with BASIC mode only.
previous steps i followed is1. go to advance mode
2. provide query string in URl
3. key in Header
Current way:1.append query in Basic mode only as below:
Source =Json.Document( Web.Contents(
"https://abcd.azurewebsites.net/api/CompatAPI/GetVSOItemsByQueryId?queryId=abcd-efgh-ijh&key=abcdefgh12345678"))
then after i went to Settings Data set and Edit Credentials,choose Anonymous and Save.
Then my issue got resolved.