Forum Discussion
Help with dynamic data source refresh and RelativePath+Web.Contents
- 3 years ago
Hi dor-rog-tech
Set the options for the data source to skip the connection test and try that again?
Hi dor-rog-tech
This is an example of what you are looking for: Power Query - Dynamic Data Source and Web.Contents() - Hat Full of Data
Thanks!
I hope I will understand what to do,
But can you please help me figure out excatly which line should I change?
- GilbertQ3 years ago
Super User
Hi dor-rog-tech
I would expect it to be in line "apiUrl" and put in the Relative Path in the section [] as in Chris Webb blog post.
- dor-rog-tech3 years ago
Helper I
Hi GilbertQ
I tried using RelataivePath as an Option and followed the instructions in the articles you sent but there is still an issue and this time it is another one:
Here is a current query:
let apiUrl = "https://api.tadabase.io/api/v1", relativePath = "/data-tables/<REPLACE-WITH-YOUR-TABLE-ID>/records", perPage = 100, GetJson = (Page) => let Options = [ Headers=[ #"X-Tadabase-App-Key"="<REPLACE WITH YOUR APP KEY>", #"X-Tadabase-App-Secret"= "<REPLACE WITH YOUR APP SECRET>", #"X-Tadabase-App-id"="<REPLACE WITH YOUR APP ID>" ], RelativePath=relativePath, Query=[ page=Page, limit=Text.From(perPage) ] ], RawData = Web.Contents(apiUrl, Options), Json = Json.Document(RawData) in Json, GetPage = (Index) => let Page = Text.From(Index), Json = GetJson(Page), Value = Json in Value, getRecords = (page as number, AccumData as list) => let Data = Function.InvokeAfter(()=>GetPage(page), #duration(0,0,0,2)), Result = if page >= Data[total_pages] then Table.FromRecords(List.Combine({AccumData, Data[items]})) else @getRecords(page + 1, List.Combine({AccumData, Data[items]})) in Result, Records = getRecords(1, {}) in #"Renamed Columns"As I understand PowerBi firstly will check the baseUrl and only then do a call. But in our case, an api requires custom headers (all 'X-Tadabase..." headers) even for the base URL
Am I right?
If so is there any way to provide these headers from outside a query?
Thank you
- GilbertQ3 years ago
Super User
Hi dor-rog-tech
Set the options for the data source to skip the connection test and try that again?