Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Good afternoon all
I am currently trying to format my M query so I can upload a report and the connected web link using the advanced section to contain the API Key will refresh. I managed to get this all working within Power BI but I am unable to format the M Query to work for relative path data this was my original code below:
I then attempted to update the code to use a relative path to make this possible update on Power BI Pro but with no luck:
When this runs it returns the API data, due to it being Paginated I run the following script to pull it into one table:
= List.Generate(()=>
[Result = try #"Proclaim Absences"(1) otherwise null, Page=1],
each [Result] <> null,
each [Result = try #"Proclaim Absences"([Page]+1) otherwise null, Page=[Page]+1],
each [Result])
Any assistance would be appreciated on how to get this working, it's a pain not being able to validate the API call in Power BI Data sets!
RelativePath is used if you need to add part of the url before the parameters (?). To add dynamic parameter use the Query option.
e.g.
Web.Contents("https://example.com",
[Query = [param1 = "1", param2 = "test"],
ApiKey = "X-API-KEY"
])
Note: As shown in the example above, it is recommended to not include key tokens in your power query, and instead use the ApiKey to indicate the name of the key parameter, and then use ApiKey authentication when you connect.
So the issue is I need the API Key within the M Query due to an auto refresh so you're suggesting I do the following:
Web.Contents("https://api.breathehr.com/v1/departments/104295/absences?per_page=100&page=",
[Query = [Param1 = Number.ToText(Page)]] , [Headers=[#"X-API-KEY"="prod-APIKeyHere"]])),