Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
scott_hsd
Frequent Visitor

Error dynamic data source, cant save dataflow using value.waitfor

Hi I am using the value.waitfor in a function with an API, I am pretty sure the parameters to this function within the web.contents is causing the issue, however, I am not sure how I can restructure this to get around this, any suggestions would be great, thanks

 

// Practitest_ProjectTests
let
    Source = (ProjectKey as text) => let
        Practitest_ProjectIssues = let
        Source = ValueWaitfor(
            (iteration) =>
                let
                    result = Web.Contents("https://api.practitest.com/api/v2/", [RelativePath= "projects/" & ProjectKey & "/tests.json?api_token=" & Practitest_api_token] & [ManualStatusHandling = {429}, IsRetry = iteration > 0]),
                    status = Value.Metadata(result)[Response.Status],
                    actualResult = if status = 429 then null else result
                in
                    actualResult,
            (iteration) => #duration(000, Number.Power(2, iteration)),
            10)
    in
        if Source = null then
            error "ValueWaitfor() Failed after multiple retry attempts"
        else
            Source,
        #"Imported JSON" = Json.Document(Practitest_ProjectIssues,65001),
        data = #"Imported JSON"[data],
        #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), nullnull, ExtraValues.Error),
        #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id""type""attributes"}, {"id""type""attributes"}),
        #"Expanded attributes" = Table.ExpandRecordColumn(#"Expanded Column1", "attributes", {"project-id""display-id""name""description""preconditions""steps-count""status""run-status""last-run""author-id""assigned-to-id""assigned-to-type""cloned-from-id""planned-execution""version""priority""duration-estimate""custom-fields""automated-test-info""tags""folder-id""created-at""updated-at"}, {"project-id""display-id""name""description""preconditions""steps-count""status""run-status""last-run""author-id""assigned-to-id""assigned-to-type""cloned-from-id""planned-execution""version""priority""duration-estimate""custom-fields""automated-test-info""tags""folder-id""created-at""updated-at"}),
        #"Expanded automated-test-info" = Table.ExpandRecordColumn(#"Expanded attributes", "automated-test-info", {"automated-test-design""script-repository""num-of-results""suite-path""client-type""script-path""results-path""script-name"}, {"automated-test-design""script-repository""num-of-results""suite-path""client-type""script-path""results-path""script-name"})
    in
        #"Expanded automated-test-info"   
in
    Source
1 ACCEPTED SOLUTION
scott_hsd
Frequent Visitor

All found the issue, so instead of this

result = Web.Contents("https://api.practitest.com/api/v2/", [RelativePath= "projects/" & ProjectKey & "/tests.json?api_token=" & Practitest_api_token] & [ManualStatusHandling = {429}, IsRetry = iteration > 0]),

 

I used this

result = Web.Contents("https://api.practitest.com/api/v2/", [RelativePath= "projects/" & ProjectKey & "/tests.json?api_token=" & Practitest_api_token, ManualStatusHandling = {429}, IsRetry = iteration > 0]),

View solution in original post

3 REPLIES 3
scott_hsd
Frequent Visitor

All found the issue, so instead of this

result = Web.Contents("https://api.practitest.com/api/v2/", [RelativePath= "projects/" & ProjectKey & "/tests.json?api_token=" & Practitest_api_token] & [ManualStatusHandling = {429}, IsRetry = iteration > 0]),

 

I used this

result = Web.Contents("https://api.practitest.com/api/v2/", [RelativePath= "projects/" & ProjectKey & "/tests.json?api_token=" & Practitest_api_token, ManualStatusHandling = {429}, IsRetry = iteration > 0]),

scott_hsd
Frequent Visitor

Thanks, I read through that, not quite sure how to disect this though

 

result = Web.Contents("https://api.practitest.com/api/v2/", [RelativePath= "projects/" & ProjectKey & "/tests.json?api_token=" & Practitest_api_token] & [ManualStatusHandling = {429}, IsRetry = iteration > 0]),

jennratten
Super User
Super User

I believe you will need to combine the various elements to create your relative path prior to passing it into the Web.Contents function. This can be done by creating the relative path in table rows and then invoking the function for the table column.

Here is a good resource:

https://hatfullofdata.blog/power-query-dynamic-data-source-and-web-contents/ 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.