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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jitpbi
Post Patron
Post Patron

add timeout in advanced editor

Hi,

 

I am trying to add timeout ([Timeout=#duration(0,2,0,0)]) to the API to get data from a web source but somehow i am not able to do it succesfully. 

Please suggest how to add [Timeout=#duration(0,0,30,0)] in the below code which can run without error.

 

 

 

jitpbi_0-1612196664633.png

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jitpbi,

As official document mention, the 'timeout' property should be an optional parameter that host in the same level as 'relativepath' and 'header'.

Web.Contents 
I think you can try to add a comma after the 'query' and append it with the 'timeout' property.

let
    rooturl = "https:/xxxx.xxxx.com/",
    authKey = "xxxxx",
    Source =
        Web.Contents(
            rooturl,
            [
                Headers = [
                    #"Authorization" = authKey,
                    #"Content-Type" = "application/json"
                ],
                RelativePath = "xxx/xxx/xxx",
                Query = [
                    startdate = xxxx,
                    enddate = xxxx
                ],
                Timeout = #duration(0, 0, 35, 0)
            ]
        )
in
    Source

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @jitpbi 

For my SQL database below is the M

Source = Sql.Databases("Server123", [CommandTimeout=#duration(0, 0, 35, 0)])

code which is used.

 

Thanks @Anonymous  for the comment. I can add the timeout in single line URL and it works. Actually long single url doesn't work in refresh so i need to break the url in small parts, like in my first post, where i am not able to add timeout properly.

thanks

Anonymous
Not applicable

Hi @jitpbi,

As official document mention, the 'timeout' property should be an optional parameter that host in the same level as 'relativepath' and 'header'.

Web.Contents 
I think you can try to add a comma after the 'query' and append it with the 'timeout' property.

let
    rooturl = "https:/xxxx.xxxx.com/",
    authKey = "xxxxx",
    Source =
        Web.Contents(
            rooturl,
            [
                Headers = [
                    #"Authorization" = authKey,
                    #"Content-Type" = "application/json"
                ],
                RelativePath = "xxx/xxx/xxx",
                Query = [
                    startdate = xxxx,
                    enddate = xxxx
                ],
                Timeout = #duration(0, 0, 35, 0)
            ]
        )
in
    Source

Regards,

Xiaoxin Sheng

Greg_Deckler
Community Champion
Community Champion

@ImkeF 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.