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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
WATYF
Helper II
Helper II

All API calls failing after the 3rd consecutive call...

I'm trying to use the REST API to automatically refresh all of my datasets after their data sources are updated every morning. I've written a .NET program that will get the list of Datasets, check who owns them, if it's not me, take ownership and set the Gateway to our on-premises Gateway, and then run the refresh for that Dataset. At most, each Dataset could require up to three API calls (not counting the original call to get the list of Datasets).

 

My problem is that after I run the first three API calls, ALL subsequent calls fail with the message "The operation has timed out". This was with the default timeout of 100 seconds on the WebRequest, and it happens when stepping through the program.

 

It doesn't matter what the first three calls are OR what the next call is that fails (it could be a call to take ownship, or set the Gateway, or run a refresh... makes no difference). For example, if the first two Datasets are already owned by me, it will fail on the attempt to take ownership of the third dataset (i.e. the fourth API call after Get Dataset call and two refresh calls). If the first one isn't owned by me, it will fail on the step to refresh it after taking ownership (i.e. the fouth API call after Get Dataset list, Take ownership, and Set Gateway). Etc. etc.

 

I've tried several differet scenarios and they all play out the same way: after I make my third call, no matter what it is, all the rest time out.

 

If I stop debugging my program and start it up again, I can do three more calls until it fails again, so it's not a "daily limit" or anything like that. I've also waited long amounts of time in between calls (particularly when I was still wokring on the program), so it's not like I'm running the calls too close together.

 

Does anyone know what might be causing this?

1 ACCEPTED SOLUTION

For the record, I found a temporary solution for this until they fix this bug: Closing the ConnectionGroup after each WebRequest is completed.

 

Assuming "wr" is your HttpWebRequest var, just use this line after you call wr.GetResponse.

 

wr.ServicePoint.CloseConnectionGroup(wr.ConnectionGroupName)

 

No more timeouts after the 2nd API POST call.

View solution in original post

5 REPLIES 5
WATYF
Helper II
Helper II

OK, this appears to only be affecting POST calls. I can run GET calls as many times as I want, but on the third POST call, it always times out. I shouldn't have been including the call to get the list of Datasets in my count, since that's a GET call, so it isn't after the 3rd API call (in general) that I get timeouts, but on the 3rd POST call.


@WATYF wrote:

OK, this appears to only be affecting POST calls. I can run GET calls as many times as I want, but on the third POST call, it always times out. I shouldn't have been including the call to get the list of Datasets in my count, since that's a GET call, so it isn't after the 3rd API call (in general) that I get timeouts, but on the 3rd POST call.


@WATYF

Thanks for reporting this issue, I could reproduce the similar timeout on the 3rd POST call. I'm going to escalate this internally and would post back if I get any update.

@Eric_Zhang

Is there some workaround in the meantime? Do you know why it fails on the 3rd consequtive call in an instance of a program, but will work again once you restart that same program? I'm disposing of all my objects, and each API call uses a unique WebRequest, so I'm trying to figure out how it even knows that the 3rd call is from the same instance of a program and the 4th (after a restart) is not.


@WATYF wrote:

@Eric_Zhang

Is there some workaround in the meantime? Do you know why it fails on the 3rd consequtive call in an instance of a program, but will work again once you restart that same program? I'm disposing of all my objects, and each API call uses a unique WebRequest, so I'm trying to figure out how it even knows that the 3rd call is from the same instance of a program and the 4th (after a restart) is not.


@WATYF

I've not yet got any update and I'll follow in this thread once I got any new information. Thanks for your patience.

For the record, I found a temporary solution for this until they fix this bug: Closing the ConnectionGroup after each WebRequest is completed.

 

Assuming "wr" is your HttpWebRequest var, just use this line after you call wr.GetResponse.

 

wr.ServicePoint.CloseConnectionGroup(wr.ConnectionGroupName)

 

No more timeouts after the 2nd API POST call.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.