Web API Query Issue

Zenly

New Member
Joined
Jan 30, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi

This is my first post on this forum. My name is Carl. :)

I wish to import the XML table https://boardgamegeek.com/xmlapi2/collection?username=Zenly&excludesubtype=boardgameexpansion into Power BI. I pasted the URL above in Power BI Desktop - Transform Data- New Source - Web - URL, and get the following response:


Zenly_0-1674566249380.jpeg



After manually refreshing I get the XML table but there seem to be an underlaying error:


Zenly_1-1674566759210.png



When I try to expand the table I get the following error:


Zenly_2-1674566834110.png



I have noticed that sometimes the XML tables from BoardGameGeek | Gaming Unplugged Since 2000 gives the "Your request for this collection has been accepted and will be processed. Please try again later for access" message, and sometimes it gives the XML table on first try. My problem is that my Power BI Query breaks once I get the Expression Error above.

Can someone please help me with a code that will bypass this problem?

Thanks for any replies. :)

-Carl

Edit: I tried Using the wait-retry pattern in Power Query connectors - Power Query | Microsoft Learn but I only have the Power BI Desktop + Pro, and part of the code is an advanced developer feature that dont work in normal Power BI Query.


Power Query:
let
    Source = Xml.Tables(Web.Contents("https://boardgamegeek.com/xmlapi2/collection?username=Zenly&stats=1")),

    waitForResult = Value.WaitFor(
        (iteration) =>
            let
                result = Web.Contents(url, [ManualStatusHandling = {500}, IsRetry = iteration > 0]),
                status = Value.Metadata(result)[Response.Status],
                actualResult = if status = 500 then null else result
            in
                actualResult,
        (iteration) => #duration(0, 0, 0, Number.Power(2, iteration)),
        5)
in
    if waitForResult = null then
        error "Value.WaitFor() Failed after multiple retry attempts"
    else
        waitForResult
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,223,992
Messages
6,175,826
Members
452,673
Latest member
LaMiaAvy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top