Forum Discussion
POST and GET request via Web API. POST request is succesful, but can't perform the GET request
lbendlin I've changed my query which resolves the cache problem by looping with a function, but now I'm getting stuck on the "evaluate" part. My query loads perfectly in the query editor, but when I close & apply my query gets stuck on the "Evaluating" part. Changing the Privacy levels, ignoring the Privacy levels and disabling "Allow data previews to download in the background" don't work. Any thoughts on what I can do to fix this?
Query:
let
//Generate the ID needed for the function
id = Json.Document(Web.Contents("https://*****/api/dataviewresult/"&Dataview&"/json?api_key=*****", [Headers=[#"Content-Type" = "application/json"],Content = Text.ToBinary("{}")]))[contents][id],
//Call status function which throws back the GET request URL once successful
Source = Status_dataview(Dataview, id),
//Create function to get the data based on the previous function
DownloadFile1 = () => Json.Document(Web.Contents(Source&"?api_key=*****")),
//Call function which starts after 10 seconds
DownloadFile = Function.InvokeAfter(DownloadFile1, #duration(0,0,0,10)),
//Dataprep
#"Converted to Table" = *****
#"Expanded Column1" = *****
in
#"Expanded Column1"
Function (Status_dataview):
(Dataview as text, id as text) =>
let
//Function to get the URL once succes based on fields/parameters: Dataview, id
Data = () => Json.Document(Web.Contents("https://*****/api/dataviewresult/" & Dataview & "/json/" & id & "/status?api_key=*****"))[contents][status],
//Call function after 10 seconds
Invoke = Function.InvokeAfter(Data,#duration(0,0,0,10)),
//Loop the function each 10 seconds, until the status is successful
output =
if Invoke = "success" then Json.Document(Web.Contents("https://*****/api/dataviewresult/" & Dataview & "/json/" & id & "/status?api_key=*****"))[contents][url] else @Status_dataview(Dataview, id)
in
output