Hi,
I am using a dynamic query in power bi desktop in order to extract all the rows from a Dynatrace API that lists all dynatrace problems. The Dynatrace api returns paginated results with a nextpage key to query for the next bunch of rows.
So I created in power BI desktop the following function called GetProblemApiResult:
= (api as text, headers as record, parameters as text, nextPageKey as text, currentList as list) =>
let
apiResult = if nextPageKey = ""
then Json.Document(Web.Contents(api & parameters, headers))
else Json.Document(Web.Contents(api & "?nextPageKey=" & nextPageKey, headers)),
newList = List.Combine({currentList, apiResult[problems]}),
hasNext = try apiResult[nextPageKey],
returnList = if hasNext[HasError]
then newList
else getProblemAPIResult(api, headers, parameters, apiResult[nextPageKey], newList)
in
returnList and then I call it in the following way:
= getProblemAPIResult("https://baseurl/api" & "/v2/problems", [Headers=[Accept="application/json; charset=utf-8", Authorization="Api-Token " & "mytoken"]], "?pageSize=500&problemSelector=problemFilterNames%28%22SNOW%20INTEGRATION%20%5BPROD%5D%22%29&entitySelector=type%28%22SYNTHETIC_TEST%22%29&from=" & "2024-01-01T00%3A00%3A01&to=now" , "", {})when I refresh the report in Power BI service it tells me that I cannot refresh a dynamic datasource.
Could you tell me how can I adjust the code so as to be able to refresh the report also on the Power BI Service?
Thank you
Kind Regards
Marta