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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dkpcr5
Helper II
Helper II

Rest API call not returning data when including $skip

Hi,

I'm trying to retrieve data from a REST API. When I exclude $skip in the call, the data returns without issue. But when I include $skip, the call seems to take 10-15 minutes before finally timing out. What am I doing wrong?

 

This call works, no problem:

 

let
Source = Json.Document(Web.Contents(
"https://url ",[RelativePath="x/y/z?$filter=Date%20eq%20%27"&DateTo&"%27%20and%20Type%20eq%20%27Base%27%20and%20Value%20ne%200%20&$top=50",
Headers=
        [   
            #"header1" = "header1",
            #"header2" = Text.Combine({header2}),
            #"response-cache" = "false",
            ]]
        )
)
in
    Source

 

 

But this one fails to load:

let
Source = Json.Document(Web.Contents(
"https://url ",[RelativePath="x/y/z?$filter=Date%20eq%20%27"&DateTo&"%27%20and%20Type%20eq%20%27Base%27%20and%20Value%20ne%200%20&$top=50&$skip=50",
Headers=
        [   
            #"header1" = "header1",
            #"header2" = Text.Combine({header2}),
            #"response-cache" = "false",
            ]]
        )
)
in
    Source

 

Again, both calls work just fine in Postman... What are some possible problems? Thanks!

5 REPLIES 5
mahoneypat
Microsoft Employee
Microsoft Employee

It is odd that it is working in Postman but now PQ, but you are packaging the Headers info differently.  You could try to look at Query Diagnostics to see the actual final URL generated/sent by Power Query to see if it matches your Postman url.  Is header2 a hard-coded list in your query?

 

You could also try moving $skip to be an earlier parameter vs at the end.

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hey Pat, thanks for the response.

In the diagnostics, I see where the call times out. It's almost the same as the Postman call, except that at the end of the OData string, there's this:

HTTP/1.1
<Headers placeholder>

So in the BI diagnostic tool, the URL where things get jammed up looks like this:

GET https://url?$filter=Date eq '2021-09-30' and Type eq 'Base' and Value ne 0 &$count=true&$top=100&$skip=0 HTTP/1.1
<Headers placeholder>

Note: that "$skip=0" is coming from Column1 custom List.Numbers function.

In Postman (runs great), it looks like this:

GET https://url?$filter=Type eq 'Base' and Date eq '2021-09-30' and Value ne 0&$count=true&$top=50&$skip=50

So, there are some minor differences. But, maybe that HTTP/1.1 is relevant?

@mahoneypat A few more details:

* No, none of the headers are lists. All headers used are either hard-coded in quotes or single-string parameters, type Text.

* In the Diagnostics_Detailed table (created from traces), I've sorted calls by Exclusive Duration. All of the most time-consuming calls (seen in the "Data Source Query" column) match what's in Postman, except for adding HTTP/1.1 <Headers placeholder>, as noted above. The "Additional Info" column shows a "Record" with further detail, including an Exception thrown. That Exception is reproduced below. It's clear that the failure is caused by a timeout, but I'm not sure how to learn more about precisely what's causing the timeout.

Again, any direction is appreciated. Thanks again for taking a look!

Exception:
ExceptionType: System.Net.WebException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=a12b3c456789d012
Message: The operation has timed out
StackTrace:
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.Mashup.Engine1.Library.Common.WrappingHttpWebRequest.<>c__DisplayClass119_0.<WrapResponse>b__0()
   at Microsoft.Mashup.Engine1.Library.Common.WrappingHttpWebRequest.WrapExceptionResponse[T](Func`1 getValue)
   at Microsoft.Mashup.Engine1.Library.Web.Request.CreateResponse(ResourceCredentialCollection credentials)
   at Microsoft.Mashup.Engine1.Library.Web.Request.GetResponseCore(ResourceCredentialCollection credentials)
   at Microsoft.Mashup.Engine1.Library.Common.RetryPolicy.Execute[TResult](IEngineHost host, Func`1 func)
   at Microsoft.Mashup.Engine1.Library.Web.Request.GetResponse(ResourceCredentialCollection credentials, RetryPolicy retryPolicy, SecurityExceptionCreator securityExceptionCreator, Boolean tokenRefreshed)

 

Not sure what else to try.  One thing would be to try the string with HTTP in Postman to see if that times out.  I did see this in the documentation.

 

mahoneypat_0-1634038686705.png

@ImkeF Any ideas or workarounds?

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Sorry, but no idea here.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors